admin
5 years ago
api
6 years ago
database
6 years ago
deprecated
6 years ago
donors
5 years ago
emails
6 years ago
forms
6 years ago
frontend
6 years ago
gateways
6 years ago
libraries
6 years ago
payments
6 years ago
actions.php
6 years ago
ajax-functions.php
6 years ago
class-give-async-process.php
6 years ago
class-give-background-updater.php
6 years ago
class-give-cache-setting.php
6 years ago
class-give-cache.php
6 years ago
class-give-cli-commands.php
6 years ago
class-give-comment.php
6 years ago
class-give-cron.php
6 years ago
class-give-donate-form.php
6 years ago
class-give-donor.php
6 years ago
class-give-email-access.php
6 years ago
class-give-license-handler.php
6 years ago
class-give-logging.php
6 years ago
class-give-readme-parser.php
6 years ago
class-give-roles.php
6 years ago
class-give-scripts.php
6 years ago
class-give-session.php
6 years ago
class-give-stats.php
6 years ago
class-give-template-loader.php
6 years ago
class-give-tooltips.php
6 years ago
class-give-translation.php
6 years ago
class-notices.php
6 years ago
country-functions.php
6 years ago
currencies-list.php
6 years ago
currency-functions.php
6 years ago
error-tracking.php
6 years ago
filters.php
6 years ago
formatting.php
6 years ago
install.php
6 years ago
login-register.php
6 years ago
misc-functions.php
5 years ago
plugin-compatibility.php
6 years ago
post-types.php
6 years ago
price-functions.php
6 years ago
process-donation.php
6 years ago
setting-functions.php
6 years ago
shortcodes.php
6 years ago
template-functions.php
6 years ago
user-functions.php
6 years ago
class-give-readme-parser.php
61 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Give Readme Parser |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Admin/Readme_Parser |
| 7 | * @copyright Copyright (c) 2018, GiveWP |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 2.1.4 |
| 10 | */ |
| 11 | class Give_Readme_Parser { |
| 12 | /** |
| 13 | * Readme file url |
| 14 | * |
| 15 | * @since 2.1.4 |
| 16 | * @access private |
| 17 | * @var |
| 18 | */ |
| 19 | private $file_url; |
| 20 | |
| 21 | /** |
| 22 | * Readme file content |
| 23 | * |
| 24 | * @since 2.1.4 |
| 25 | * @access private |
| 26 | * @var |
| 27 | */ |
| 28 | private $file_content; |
| 29 | |
| 30 | /** |
| 31 | * Give_Readme_Parser constructor. |
| 32 | * |
| 33 | * @param string $file_url |
| 34 | */ |
| 35 | function __construct( $file_url ) { |
| 36 | $this->file_url = $file_url; |
| 37 | $this->file_content = wp_remote_retrieve_body( wp_remote_get( $this->file_url ) ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get required Give core minimum version for addon |
| 42 | * |
| 43 | * @since 2.1.4 |
| 44 | * @access public |
| 45 | * |
| 46 | * @return string |
| 47 | */ |
| 48 | public function requires_at_least() { |
| 49 | // Regex to extract Give core minimum version from the readme.txt file. |
| 50 | preg_match( '|Requires Give:(.*)|i', $this->file_content, $_requires_at_least ); |
| 51 | |
| 52 | if ( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) { |
| 53 | $_requires_at_least = trim( $_requires_at_least[1] ); |
| 54 | } else { |
| 55 | $_requires_at_least = null; |
| 56 | } |
| 57 | |
| 58 | return $_requires_at_least; |
| 59 | } |
| 60 | } |
| 61 |