Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-23 21:44:59

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Test TXP version in plugin

What’s the best way of testing the TXP version from within a plugin? Is there a standard behind-the-scenes function?

With the great features in 4.0.9 (pluggable_ui & plugin options) it would be useful if there was something to test if the version was a specified level or above.

Thanks,

Adi

Offline

#2 2009-04-23 22:28:56

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Test TXP version in plugin

if (version_compare(txp_version, '4.0.9', '<'))
    exit('4.0.9 is required.');
else
    // install

Offline

#3 2009-04-23 23:00:09

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Test TXP version in plugin

Perfect … thanks Jon-Michael.

Offline

#4 2009-04-23 23:50:45

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Test TXP version in plugin

How about checking for version greater than 4.0.6?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2009-04-24 00:37:00

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Test TXP version in plugin

gomedia wrote:

Perfect … thanks Jon-Michael.

No problem.

MattD wrote:

How about checking for version greater than 4.0.6?

Were you looking for something like the following?

if (version_compare(txp_version, '4.0.6', '>'))

Or:

if (version_compare(txp_version, '4.0.7', '>='))

Offline

Board footer

Powered by FluxBB