I have a framework for WordPress that can be embedded into either a plugin, a theme or a child theme. In order to return proper URLs, the script needs to determine from where it is being executed.
I believe I could do something like matching
get_stylesheet_directory_uri()(theme or child theme), or
plugin_dir_url( __FILE__ )(plugin)
Is there a better, more reliable approach than using
strpos() to compare the above? How would I go about it?