| 43 | | // try to figure out whether we are embedded (for example running from Wordpress) |
| 44 | | // on windows/apache $_SERVER['PATH_TRANSLATED'] uses "/" for directory separators, |
| 45 | | // PATH_TRANSLATED is deprecated |
| 46 | | // __FILE__ has them the other way, realpath takes care of that. |
| 47 | | if (!defined('PLOGGER_EMBEDDED') || PLOGGER_EMBEDDED=='') { |
| 48 | | if (dirname(__FILE__) != dirname(realpath($_SERVER["SCRIPT_NAME"])) && strpos($_SERVER["SCRIPT_NAME"],"admin") === false) { |
| 49 | | $config["embedded"] = 1; |
| 50 | | // disable our own cruft-free urls, because the URL has already been processed |
| 51 | | // by WordPress |
| 52 | | $config["use_mod_rewrite"] = 0; |
| 53 | | trace('Autofund Wordpress!'); |
| 54 | | trace('dirname: ' . dirname(__FILE__)); |
| 55 | | trace('$_SERVER["SCRIPT_NAME"]' .': '. $_SERVER["SCRIPT_NAME"]); |
| 56 | | trace('realpath($_SERVER["SCRIPT_NAME"])' .': '. realpath($_SERVER["SCRIPT_NAME"])); |
| 57 | | } else { |
| 58 | | $config["embedded"] = 0; |
| 59 | | $config["baseurl"] = "http://".$_SERVER["HTTP_HOST"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/"; |
| 60 | | trace('Autofund just a website!'); |
| 61 | | } |
| | 43 | // Try to figure out whether we are embedded (for example running from Wordpress) |
| | 44 | // Using $_SERVER['SCRIPT_FILENAME'] should produce the same result as __FILE__ if inclusion script in same location as Plogger |
| | 45 | // in some environments (virtual hosts) $_SERVER['SCRIPT_FILENAME'] is not the correct absolute path, but realpath() seems to clear it up |
| | 46 | // Set PLOGGER_EMBEDDED to 1 in config file to overrule automatic test |
| | 47 | // in case Plogger inclusion in different folder location, but doesn't already use mod_rewrite paths |
| | 48 | if ((PLOGGER_EMBEDDED == '1') || (dirname(__FILE__) != dirname(realpath($_SERVER['SCRIPT_FILENAME'])) && strpos($_SERVER['SCRIPT_FILENAME'],"admin") === false)) { |
| | 49 | $config["embedded"] = 1; |
| | 50 | // disable our own cruft-free urls, because the URL has already been processed |
| | 51 | // by WordPress |
| | 52 | $config["use_mod_rewrite"] = 0; |
| | 53 | trace('Plogger is embedded'); |
| | 54 | trace('dirname: ' . dirname(__FILE__)); |
| | 55 | trace('$_SERVER[\'SCRIPT_FILENAME\']' .': '. $_SERVER['SCRIPT_FILENAME']); |
| | 56 | trace('realpath($_SERVER[\'SCRIPT_FILENAME\'])' .': '. realpath($_SERVER['SCRIPT_FILENAME'])); |