← All changes
|
freemius/includes/managers/class-fs-plugin-manager.php
+17
-4
1.3.0
→
trunk
View file →
| @@ -210,11 +210,24 @@ | ||
| 210 | 210 | * |
| 211 | 211 | * @return bool|\FS_Plugin |
| 212 | 212 | */ |
| 213 | 213 | function get() { |
| 214 | - return isset( $this->_module ) ? | |
| 215 | - $this->_module : | |
| 216 | - false; | |
| 217 | - } | |
| 214 | + if ( isset( $this->_module ) ) { | |
| 215 | + return $this->_module; | |
| 216 | + } | |
| 218 | 217 | |
| 218 | + if ( empty( $this->_module_id ) ) { | |
| 219 | + return false; | |
| 220 | + } | |
| 219 | 221 | |
| 222 | + /** | |
| 223 | + * Return an FS_Plugin entity that has its `id` and `is_live` properties set (`is_live` is initialized in the FS_Plugin constructor) to avoid triggering an error that is relevant to these properties when the FS_Plugin entity is used before the `parse_settings()` method is called. This can happen when creating a regular WordPress site by cloning a subsite of a multisite network and the data that is stored in the network-level storage is not cloned. | |
| 224 | + * | |
| 225 | + * @author Leo Fajardo (@leorw) | |
| 226 | + * @since 2.5.0 | |
| 227 | + */ | |
| 228 | + $plugin = new FS_Plugin(); | |
| 229 | + $plugin->id = $this->_module_id; | |
| 230 | + | |
| 231 | + return $plugin; | |
| 232 | + } | |
| 220 | 233 | } |