| 1 |  |  | <?php | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace GV; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | /** If this file is called directly, abort. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | 	die(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * The GravityView WordPress plugin class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * Contains functionality related to GravityView being | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * a WordPress plugin and doing WordPress pluginy things. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * Accessible via gravityview()->plugin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | final class Plugin { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	 * @var string The plugin version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	public static $version = GV_PLUGIN_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	 * @var string Minimum WordPress version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	 * GravityView requires at least this version of WordPress to function properly. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	private static $min_wp_version = GV_MIN_WP_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	 * @var string Minimum Gravity Forms version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	 * GravityView requires at least this version of Gravity Forms to function properly. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	public static $min_gf_version = GV_MIN_GF_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	 * @var string Minimum PHP version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * GravityView requires at least this version of PHP to function properly. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	private static $min_php_version = GV_MIN_PHP_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 * @var string|bool Minimum future PHP version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	 * GravityView will require this version of PHP soon. False if no future PHP version changes are planned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	private static $future_min_php_version = GV_FUTURE_MIN_PHP_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 * @var string|bool Minimum future Gravity Forms version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	 * GravityView will require this version of Gravity Forms soon. False if no future Gravity Forms version changes are planned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	private static $future_min_gf_version = GV_FUTURE_MIN_GF_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	 * @var \GV\Plugin The \GV\Plugin static instance. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 	private static $__instance = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	 * @var \GV\Addon_Settings The plugin "addon" settings. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	public $settings; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	 * @var string The GFQuery functionality identifier. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	const FEATURE_GFQUERY = 'gfquery'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	 * @var string The joins functionality identifier. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	const FEATURE_JOINS = 'joins'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	 * @var string The unions functionality identifier. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	const FEATURE_UNIONS = 'unions'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	 * @var string The REST API functionality identifier. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	const FEATURE_REST  = 'rest_api'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	 * Get the global instance of \GV\Plugin. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 	 * @return \GV\Plugin The global instance of GravityView Plugin. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	public static function get() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		if ( ! self::$__instance instanceof self ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 			self::$__instance = new self; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		return self::$__instance; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 	private function __construct() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 		 * Load translations. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 		add_action( 'init', array( $this, 'load_textdomain' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		 * Load some frontend-related legacy files. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 		add_action( 'gravityview/loaded', array( $this, 'include_legacy_frontend' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 		 * GFAddOn-backed settings, licensing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 		add_action( 'plugins_loaded', array( $this, 'load_license_settings' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  | 	public function load_license_settings() { | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  | 		require_once $this->dir( 'future/includes/class-gv-license-handler.php' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  | 		require_once $this->dir( 'future/includes/class-gv-settings-addon.php' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  | 		if ( class_exists( '\GV\Addon_Settings' ) ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  | 			$this->settings = new Addon_Settings(); | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  | 			include_once $this->dir( 'includes/class-gravityview-settings.php' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 130 |  |  | 		} else { | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  | 			gravityview()->log->notice( '\GV\Addon_Settings not loaded. Missing \GFAddOn.' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 | 1 |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 | 1 |  | 	 * Check whether GravityView is network activated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	 * @return bool Whether it's network activated or not. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	public static function is_network_activated() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 		return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 	 * Include more legacy stuff. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 	 * @param boolean $force Whether to force the includes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 	public function include_legacy_frontend( $force = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 		if ( gravityview()->request->is_admin() && ! $force ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 		include_once $this->dir( 'includes/class-gravityview-image.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 		include_once $this->dir( 'includes/class-template.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 		include_once $this->dir( 'includes/class-api.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 		include_once $this->dir( 'includes/class-frontend-views.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 		include_once $this->dir( 'includes/class-gravityview-change-entry-creator.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 		 * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 		 * @deprecated Use `gravityview/loaded` along with \GV\Request::is_admin(), etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 		 * Nice place to insert extensions' frontend stuff | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		do_action( 'gravityview_include_frontend_actions' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	 * Load more legacy core files. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 	public function include_legacy_core() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 		// Load fields | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		include_once $this->dir( 'includes/fields/class-gravityview-fields.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 		include_once $this->dir( 'includes/fields/class-gravityview-field.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 		// Load all field files automatically | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 		foreach ( glob( $this->dir( 'includes/fields/class-gravityview-field*.php' ) ) as $gv_field_filename ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 			include_once $gv_field_filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 		include_once $this->dir( 'includes/class-gravityview-entry-approval-status.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 		include_once $this->dir( 'includes/class-gravityview-entry-approval.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		include_once $this->dir( 'includes/class-gravityview-entry-notes.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 		include_once $this->dir( 'includes/load-plugin-and-theme-hooks.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		// Load Extensions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		// @todo: Convert to a scan of the directory or a method where this all lives | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		include_once $this->dir( 'includes/extensions/edit-entry/class-edit-entry.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 		include_once $this->dir( 'includes/extensions/delete-entry/class-delete-entry.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 		include_once $this->dir( 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 		// Load WordPress Widgets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 		include_once $this->dir( 'includes/wordpress-widgets/register-wordpress-widgets.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		// Load GravityView Widgets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		include_once $this->dir( 'includes/widgets/register-gravityview-widgets.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		// Add oEmbed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 		include_once $this->dir( 'includes/class-api.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 		include_once $this->dir( 'includes/class-oembed.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 		// Add logging | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 		include_once $this->dir( 'includes/class-gravityview-logging.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 		include_once $this->dir( 'includes/class-ajax.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 		include_once $this->dir( 'includes/class-gravityview-html-elements.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 		include_once $this->dir( 'includes/class-frontend-views.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 		include_once $this->dir( 'includes/class-gravityview-admin-bar.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 		include_once $this->dir( 'includes/class-gravityview-entry-list.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 		include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 		include_once $this->dir( 'includes/class-data.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 		include_once $this->dir( 'includes/class-gravityview-shortcode.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 		include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 		include_once $this->dir( 'includes/class-gvlogic-shortcode.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		include_once $this->dir( 'includes/presets/register-default-templates.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 		if ( class_exists( '\GFFormsModel' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 			include_once $this->dir( 'includes/class-gravityview-gfformsmodel.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 		if ( ! class_exists( '\GravityView_Extension' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 			include_once $this->dir( 'includes/class-gravityview-extension.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 	 * Load the translations. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 	 * Order of look-ups: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 	 * 1. /wp-content/languages/plugins/gravityview-{locale}.mo (loaded by WordPress Core) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 	 * 2. /wp-content/mu-plugins/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 	 * 3. /wp-content/mu-plugins/languages/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 	 * 4. /wp-content/plugins/gravityview/languages/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 	public function load_textdomain() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 		$domain = 'gravityview'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 		// 1. /wp-content/languages/plugins/gravityview-{locale}.mo (loaded by WordPress Core) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 		if ( is_textdomain_loaded( $domain ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 		// 2. /wp-content/languages/plugins/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 		// 3. /wp-content/mu-plugins/plugins/languages/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 		$loaded = load_muplugin_textdomain( $domain, '/languages/' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		if ( $loaded ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 		// 4. /wp-content/plugins/gravityview/languages/gravityview-{locale}.mo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 		$loaded = load_plugin_textdomain( $domain, false, $this->relpath( '/languages/' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 		if ( $loaded ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		// Pre-4.6 loading | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 		// TODO: Remove when GV minimum version is WordPress 4.6.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 		$locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 | 1 |  | 		$loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir('languages'), $domain, $locale ) ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 		if( $loaded ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 1 |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 | 1 |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 		gravityview()->log->error( sprintf( 'Unable to load textdomain for %s locale.', $locale ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 | 1 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | 	 * Register hooks that are fired when the plugin is activated and deactivated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 | 1 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 | 1 |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  | 	public function register_activation_hooks() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  | 		register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 | 1 |  | 		register_deactivation_hook( $this->dir( 'gravityview.php' ), array( $this, 'deactivate' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 | 1 |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  | 	 * Plugin activation function. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 | 1 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 | 1 |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | 	public function activate() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | 		gravityview(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | 		/** Register the gravityview post type upon WordPress core init. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  | 		require_once $this->dir( 'future/includes/class-gv-view.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 		View::register_post_type(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  | 		/** Add the entry rewrite endpoint. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  | 		require_once $this->dir( 'future/includes/class-gv-entry.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  | 		Entry::add_rewrite_endpoint(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | 		/** Flush all URL rewrites. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  | 		flush_rewrite_rules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 		update_option( 'gv_version', self::$version ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  | 		/** Add the transient to redirect to configuration page. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  | 		set_transient( '_gv_activation_redirect', true, 60 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 | 76 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 | 76 |  | 		/** Clear settings transient. */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  | 		delete_transient( 'gravityview_edd-activate_valid' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  | 		\GravityView_Roles_Capabilities::get_instance()->add_caps(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | 	 * Plugin deactivation function. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  | 	 * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 | 1 |  | 	public function deactivate() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 | 1 |  | 		flush_rewrite_rules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  | 	 * Retrieve an absolute path within the GravityView plugin directory. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  | 	 * @param string $path Optional. Append this extra path component. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  | 	 * @return string The absolute path to the plugin directory. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 | 2 |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  | 	public function dir( $path = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 | 2 |  | 		return wp_normalize_path( GRAVITYVIEW_DIR . ltrim( $path, '/' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 | 2 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  | 	 * Retrieve a relative path to the GravityView plugin directory from the WordPress plugin directory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  | 	 * @since 2.2.3 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  | 	 * @param string $path Optional. Append this extra path component. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  | 	 * @return string The relative path to the plugin directory from the plugin directory. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  | 	public function relpath( $path = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 | 2 |  | 		$dirname = trailingslashit( dirname( plugin_basename( GRAVITYVIEW_FILE ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  | 		return wp_normalize_path( $dirname . ltrim( $path, '/' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  | 	 * Retrieve a URL within the GravityView plugin directory. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | 	 * @param string $path Optional. Extra path appended to the URL. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  | 	 * @return string The URL to this plugin, with trailing slash. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  | 	public function url( $path = '/' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  | 		return plugins_url( $path, $this->dir( 'gravityview.php' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  | 	 * Is everything compatible with this version of GravityView? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  | 	 * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 | 2 |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  | 	public function is_compatible() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 | 2 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 | 2 |  | 			$this->is_compatible_php() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  | 			&& $this->is_compatible_wordpress() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | 			&& $this->is_compatible_gravityforms(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 | 2 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  | 	 * Is this version of GravityView compatible with the current version of PHP? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  | 	 * @return bool true if compatible, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  | 	public function is_compatible_php() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 | 2 |  | 		return version_compare( $this->get_php_version(), self::$min_php_version, '>=' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 | 2 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  | 	 * Is this version of GravityView compatible with the future required version of PHP? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  | 	 * @return bool true if compatible, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  | 	public function is_compatible_future_php() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  | 		return version_compare( $this->get_php_version(), self::$future_min_php_version, '>=' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  | 	 * Is this version of GravityView compatible with the current version of WordPress? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  | 	 * @param string $version Version to check against; otherwise uses GV_MIN_WP_VERSION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | 	 * @return bool true if compatible, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 | 1 |  | 	public function is_compatible_wordpress( $version = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 | 1 |  | 		if( ! $version ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  | 			$version = self::$min_wp_version; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  | 		return version_compare( $this->get_wordpress_version(), $version, '>=' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  | 	 * Is this version of GravityView compatible with the current version of Gravity Forms? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 | 1 |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 | 1 |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 | 1 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  | 	 * @return bool true if compatible, false otherwise (or not active/installed). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  | 	public function is_compatible_gravityforms() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  | 		$version = $this->get_gravityforms_version(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  | 		return $version ? version_compare( $version, self::$min_gf_version, '>=' ) : false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  | 	 * Is this version of GravityView compatible with the future version of Gravity Forms? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 | 1 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 | 1 |  | 	 * @api | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  | 	 * @since 2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  | 	 * @return bool true if compatible, false otherwise (or not active/installed). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 | 1 |  | 	public function is_compatible_future_gravityforms() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 | 1 |  | 		$version = $this->get_gravityforms_version(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  | 		return $version ? version_compare( $version, self::$future_min_gf_version, '>=' ) : false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  | 	 * Retrieve the current PHP version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  | 	 * Overridable with GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE during testing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  | 	 * @return string The version of PHP. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 | 125 |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 | 125 |  | 	private function get_php_version() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  | 		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  | 			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 | 125 |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 | 125 |  | 	 * Retrieve the current WordPress version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 | 110 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 | 125 |  | 	 * Overridable with GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE during testing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 | 125 |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  | 	 * @return string The version of WordPress. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  | 	private function get_wordpress_version() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  | 		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  | 			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  | 	 * Retrieve the current Gravity Forms version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  | 	 * Overridable with GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE during testing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  | 	 * @return string|null The version of Gravity Forms or null if inactive. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  | 	private function get_gravityforms_version() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  | 		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  | 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  | 		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  | 			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  | 	 * Feature support detection. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  | 	 * @param string $feature Feature name. Check FEATURE_* class constants. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  | 	 * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  | 	public function supports( $feature ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  | 		if ( ! is_null( $supports = apply_filters( "gravityview/plugin/feature/$feature", null ) ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  | 			return $supports; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  | 		switch ( $feature ): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  | 				case self::FEATURE_GFQUERY: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  | 					return class_exists( '\GF_Query' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  | 				case self::FEATURE_JOINS: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  | 				case self::FEATURE_UNIONS: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  | 					return apply_filters( 'gravityview/query/class', false ) === '\GF_Patched_Query'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  | 				case self::FEATURE_REST: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  | 					return class_exists( '\WP_REST_Controller' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  | 			default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  | 				return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  | 		endswitch; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  | 	 * Delete GravityView Views, settings, roles, caps, etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  | 	public function uninstall() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  | 		global $wpdb; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  | 		$suppress = $wpdb->suppress_errors(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  | 		 * Posts. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  | 		$items = get_posts( array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  | 			'post_type' => 'gravityview', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  | 			'post_status' => 'any', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  | 			'numberposts' => -1, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  | 			'fields' => 'ids' | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  | 		) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  | 		foreach ( $items as $item ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  | 			wp_delete_post( $item, true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  | 		 * Meta. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  | 		$tables = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  | 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  | 			$tables []= \GFFormsModel::get_entry_meta_table_name(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  | 		$tables []= \GFFormsModel::get_lead_meta_table_name(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  | 		foreach ( $tables as $meta_table ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  | 			$sql = " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  | 				DELETE FROM $meta_table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  | 				WHERE ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  | 					`meta_key` = 'is_approved' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  | 			"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  | 			$wpdb->query( $sql ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  | 		 * Notes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  | 		$tables = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  | 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  | 			$tables[] = \GFFormsModel::get_entry_notes_table_name(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  | 		$tables[] = \GFFormsModel::get_lead_notes_table_name(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  | 		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  | 		$approved = __('Approved the Entry for GravityView', 'gravityview'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  | 		$suppress = $wpdb->suppress_errors(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  | 		foreach ( $tables as $notes_table ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  | 			$sql = $wpdb->prepare( " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  | 				DELETE FROM $notes_table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  | 				WHERE ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  | 					`note_type` = 'gravityview' OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  | 					`value` = %s OR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  | 					`value` = %s | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  | 			", $approved, $disapproved ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  | 			$wpdb->query( $sql ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  | 		$wpdb->suppress_errors( $suppress ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  | 		 * Capabilities. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  | 		\GravityView_Roles_Capabilities::get_instance()->remove_caps(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  | 		 * Options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  | 		delete_option( 'gravityview_cache_blacklist' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  | 		delete_option( 'gv_version_upgraded_from' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  | 		delete_transient( 'gravityview_edd-activate_valid' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  | 		delete_transient( 'gravityview_edd-deactivate_valid' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  | 		delete_transient( 'gravityview_dismissed_notices' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  | 		delete_site_transient( 'gravityview_related_plugins' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  | 	private function __clone() { } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  | 	private function __wakeup() { } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 618 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 619 |  |  |  | 
            
                        
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.