[TYPO3-core] [TYPO3-core-internal] Deprecation strategy

Marc Wöhlken woehlken at quadracom.de
Tue Jul 10 18:27:32 CEST 2012


Hi Benni!
Am 10.07.2012 16:14, schrieb Benjamin Mack:
> For my extensions, I will need to maintain two versions, which sucks big
> time.
In some projects I use a very simple "version abstraction layer" like this:

<?php

class compatibility {
  static function intInRange($theInt,$min,$max = 2000000000 ,$zeroValue
= 0) {
    if(method_exists('t3lib_div','intInRange')) {
      return t3lib_div::intInRange($theInt,$min,$max,$zeroValue);
    } else {
      return
t3lib_utility_math::forceIntegerInRange($theInt,$min,$max,$zeroValue);
    }
  }

  static function readLLXMLfile($fileRef,$langKey,$charset = '') {
    if(method_exists('t3lib_div','readLLXMLfile')) {
      return t3lib_div::readLLXMLfile($fileRef,$langKey,$charset);
    } else {
      return
t3lib_l10n_parser_Llxml::getParsedData($fileRef,$langKey,$charset);
    }
  }
}

// Example usage
$int = compatibility::intInRange(50,0,100);
$local_lang =
compatibility::readLLXMLfile('/var/www/default/typo3conf/ext/my_ext/locallang.xml','de');
?>

May not be most elegant but works fine as long as the method parameters
don't change too much.

Bye
Marc


-- 
...........................................................
Marc Wöhlken                     TYPO3 certified integrator

Quadracom - Proffe & Wöhlken

Rembertistraße 32              WWW: http://www.quadracom.de
D-28203 Bremen                E-Mail: woehlken at quadracom.de
______________             PGP-Key: http://pgp.quadracom.de




More information about the TYPO3-team-core mailing list