added info in class about path construction
This commit is contained in:
@@ -152,10 +152,21 @@ class PLGNTLS_class
|
|||||||
private static function set_root_dir() {
|
private static function set_root_dir() {
|
||||||
if (isset(self::$_plugin_name, self::$_file_name, self::$_file_dir_path, self::$_plugin_dir_path))
|
if (isset(self::$_plugin_name, self::$_file_name, self::$_file_dir_path, self::$_plugin_dir_path))
|
||||||
return ;
|
return ;
|
||||||
|
/*
|
||||||
|
* it uses exploded_path_path by removing data from the array
|
||||||
|
* so order is important !
|
||||||
|
* plugin_name / path / to / file.php
|
||||||
|
* exploded [plugin_name, path, to, file.php]
|
||||||
|
* plugin_name plugin_name [path, to, file.php]
|
||||||
|
* file_name [path, to] file.php
|
||||||
|
* file_dir_name path / to
|
||||||
|
*/
|
||||||
$exploded_plugin_path = explode('/', plugin_basename( __FILE__ ));
|
$exploded_plugin_path = explode('/', plugin_basename( __FILE__ ));
|
||||||
|
|
||||||
self::$_plugin_name = array_shift($exploded_plugin_path);
|
self::$_plugin_name = array_shift($exploded_plugin_path);
|
||||||
self::$_file_name = array_pop($exploded_plugin_path);
|
self::$_file_name = array_pop($exploded_plugin_path);
|
||||||
self::$_file_dir_path = implode('/', $exploded_plugin_path);
|
self::$_file_dir_path = implode('/', $exploded_plugin_path);
|
||||||
|
|
||||||
self::$_plugin_dir_path = str_replace('/'.plugin_basename(__DIR__).'/', '', plugin_dir_path(__FILE__));
|
self::$_plugin_dir_path = str_replace('/'.plugin_basename(__DIR__).'/', '', plugin_dir_path(__FILE__));
|
||||||
self::$_root_path = self::$_plugin_dir_path.'/'.self::$_plugin_name.'/';
|
self::$_root_path = self::$_plugin_dir_path.'/'.self::$_plugin_name.'/';
|
||||||
self::$_root_url = plugins_url(self::$_plugin_name.'/');
|
self::$_root_url = plugins_url(self::$_plugin_name.'/');
|
||||||
|
|||||||
Reference in New Issue
Block a user