[Plugin: Flutter] Non-standard wp-content location and Fluttter paths
-
First things first, I’m really digging this plugin, thanks!
I’ve been using a non-standard location for the wp-content folder and noticed some issues Flutter has with this setup. At the bottom of canvas-globals.php and top of RCCWP_Constant.php there seems to be some funky string magic going on that returns the wrong path for my installation, breaking javascript, css, etc.
I went ahead and used the WordPress path constants and a dash of string magic to fix it and it seems to work and I haven’t noticed any weird side-effects. What do the people think?
From RCCWP_Constant.php in Flutter directory:
// From RCCWP_Constant.php in Flutter/
// Flutter paths
preg_match('/wp-content(.*)(RCCWP_Constant\.php)$/',__FILE__,$flutterpath);
$flutterpath = str_replace('\\', '/', $flutterpath);
define('FLUTTER_PLUGIN_DIR', dirname(plugin_basename(__FILE__))); // returns Flutter
//define("FLUTTER_PATH", str_replace('/RCCWP_Constant.php', '', str_replace('\\', '/', __FILE__)));
define("FLUTTER_PATH", dirname(__FILE__));
define("FLUTTER_URI", get_bloginfo('wpurl').'/wp-content'.$flutterpath[1]); //returns somthing similar to "https://127.0.0.1/wp-content/plugins/Flutter/"
define("FLUTTER_URI_RELATIVE", 'wp-content'.$flutterpath[1]); //returns somthing similar to "wp-content/plugins/Flutter/"
To:
define('FLUTTER_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
define("FLUTTER_PATH", dirname(__FILE__));
define("FLUTTER_URI", WP_PLUGIN_URL. '/'.FLUTTER_PLUGIN_DIR.'/');
define("FLUTTER_URI_RELATIVE", str_replace(WP_CONTENT_URL, '', FLUTTER_URI));
From canvas-globals.php:
// Canvas paths
preg_match('/wp-content(.*)(canvas-globals\.php)$/',__FILE__,$canvaspath);
$canvaspath = str_replace('\\', '/', $canvaspath);
define(CANVASPATH, str_replace('/canvas-globals.php', '', str_replace('\\', '/', __FILE__)));
define(CANVASURI, get_bloginfo('wpurl').'/wp-content'.$canvaspath[1]); //returns "https://127.0.0.1/wp-content/plugins/Flutter/"
define(FLUTTER_URI_RELATIVE, 'wp-content'.$canvaspath[1]); //returns "wp-content/plugins/Flutter/"
To:
define(CANVASPATH, dirname(__FILE__));
define(CANVASURI, WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/');
define(FLUTTER_URI_RELATIVE, str_replace(WP_CONTENT_URL, '', FLUTTER_URI));
- The topic ‘[Plugin: Flutter] Non-standard wp-content location and Fluttter paths’ is closed to new replies.