I am making a simple PHP library for my own personal toolbox which involves caching variables on the server.

If the library is being run on a WP site it will use the Transient API instead of the APC extension to cache the data.

As it stands, my litmus test to see if it's a WP environment is to check if get_the_permalink() function exists and to see if the constant WP_CONTENT_DIR has been defined.

I feel this is a bit hacky and would like to know if there is a better way to go about this.