diff --git a/Puc/v4p9/Plugin/Info.php b/Puc/v4p9/Plugin/Info.php index 00695d6..e3ed5d4 100644 --- a/Puc/v4p9/Plugin/Info.php +++ b/Puc/v4p9/Plugin/Info.php @@ -27,6 +27,7 @@ if ( !class_exists('Puc_v4p9_Plugin_Info', false) ): public $requires; public $tested; + public $requires_php; public $upgrade_notice; public $rating; @@ -94,6 +95,7 @@ if ( !class_exists('Puc_v4p9_Plugin_Info', false) ): $sameFormat = array( 'name', 'slug', 'version', 'requires', 'tested', 'rating', 'upgrade_notice', 'num_ratings', 'downloaded', 'active_installs', 'homepage', 'last_updated', + 'requires_php', ); foreach($sameFormat as $field){ if ( isset($this->$field) ) { diff --git a/Puc/v4p9/Plugin/Update.php b/Puc/v4p9/Plugin/Update.php index 4345617..4456001 100644 --- a/Puc/v4p9/Plugin/Update.php +++ b/Puc/v4p9/Plugin/Update.php @@ -13,11 +13,12 @@ if ( !class_exists('Puc_v4p9_Plugin_Update', false) ): public $homepage; public $upgrade_notice; public $tested; + public $requires_php = false; public $icons = array(); public $filename; //Plugin filename relative to the plugins directory. protected static $extraFields = array( - 'id', 'homepage', 'tested', 'upgrade_notice', 'icons', 'filename', + 'id', 'homepage', 'tested', 'requires_php', 'upgrade_notice', 'icons', 'filename', ); /** @@ -79,6 +80,7 @@ if ( !class_exists('Puc_v4p9_Plugin_Update', false) ): $update->id = $this->id; $update->url = $this->homepage; $update->tested = $this->tested; + $update->requires_php = $this->requires_php; $update->plugin = $this->filename; if ( !empty($this->upgrade_notice) ) { diff --git a/Puc/v4p9/Vcs/PluginUpdateChecker.php b/Puc/v4p9/Vcs/PluginUpdateChecker.php index fab268f..27200ff 100644 --- a/Puc/v4p9/Vcs/PluginUpdateChecker.php +++ b/Puc/v4p9/Vcs/PluginUpdateChecker.php @@ -139,6 +139,8 @@ if ( !class_exists('Puc_v4p9_Vcs_PluginUpdateChecker') ): 'Tested WP' => 'tested', 'Requires at least' => 'requires', 'Tested up to' => 'tested', + + 'Requires PHP' => 'requires_php', ); foreach ($headerToPropertyMap as $headerName => $property) { if ( isset($fileHeader[$headerName]) && !empty($fileHeader[$headerName]) ) { @@ -172,6 +174,9 @@ if ( !class_exists('Puc_v4p9_Vcs_PluginUpdateChecker') ): if ( !empty($readme['requires_at_least']) ) { $pluginInfo->requires = $readme['requires_at_least']; } + if ( !empty($readme['requires_php']) ) { + $pluginInfo->requires_php = $readme['requires_php']; + } if ( isset($readme['upgrade_notice'], $readme['upgrade_notice'][$pluginInfo->version]) ) { $pluginInfo->upgrade_notice = $readme['upgrade_notice'][$pluginInfo->version]; diff --git a/vendor/PucReadmeParser.php b/vendor/PucReadmeParser.php index ea24751..1f5cec9 100644 --- a/vendor/PucReadmeParser.php +++ b/vendor/PucReadmeParser.php @@ -52,6 +52,12 @@ class PucReadmeParser { else $tested_up_to = NULL; + // Requires PHP: 5.2.4 + if ( preg_match('|Requires PHP:(.*)|i', $file_contents, $_requires_php) ) { + $requires_php = $this->sanitize_text( $_requires_php[1] ); + } else { + $requires_php = null; + } // Stable tag: 10.4-ride-the-fire-eagle-danger-day if ( preg_match('|Stable tag:(.*)|i', $file_contents, $_stable_tag) ) @@ -196,6 +202,7 @@ class PucReadmeParser { 'tags' => $tags, 'requires_at_least' => $requires_at_least, 'tested_up_to' => $tested_up_to, + 'requires_php' => $requires_php, 'stable_tag' => $stable_tag, 'contributors' => $contributors, 'donate_link' => $donate_link,