Skip to content

Instantly share code, notes, and snippets.

@PaulHughes01
Created March 19, 2012 18:26
Show Gist options
  • Select an option

  • Save PaulHughes01/2122918 to your computer and use it in GitHub Desktop.

Select an option

Save PaulHughes01/2122918 to your computer and use it in GitHub Desktop.
<?php
// From events-calendar-pro.php
public function checkRequiredTecVersion( $array ) {
$array['TribeEventsPro'] = array('plugin_name' => 'Events Calendar Pro', 'required_version' => TribeEventsPro::REQUIRED_TEC_VERSION);
return $array;
}
// From the-events-calendar.class.php
public function checkAddOnCompatibility() {
$bad_versions = array();
$tec_addons_required_versions = array();
$tec_addons_required_versions = (array) apply_filters('tribe_tec_addons', $tec_addons_required_versions);
foreach ($tec_addons_required_versions as $plugin) {
if ( version_compare( $plugin['required_version'], self::VERSION, '>') ) {
$bad_versions[$plugin['plugin_name']] = $plugin['required_version'];
}
}
if ( count( $bad_versions ) > 0 ) {
echo '<div class="error">';
foreach ($bad_versions as $plugin => $version) {
echo '<p>';
printf( __('Your version of %s requires version %s or higher of The Events Calendar. Use at your own risk!', 'tribe-events-calendar'), $plugin, $version );
echo '</p>';
}
echo '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment