Set paths, name etc for a plugin

@param string $the__file__ Pass `__FILE__` from the loader through Constructor.
166549
protected function set_plugin( $the__file__ ) {
		if ( ! function_exists( 'get_plugins' ) ) {
			/* @noinspection PhpIncludeInspection */
			require_once ABSPATH . 'wp-admin/includes/plugin.php';
		}

		$this->plugin['fullpath'] = $the__file__;
		$this->plugin['basename'] = plugin_basename( $this->plugin['fullpath'] );
		list( $this->plugin['dirname'], $this->plugin['filename'] ) = explode( '/', $this->plugin['basename'] );

		$plugin_data          = get_plugin_data( $this->plugin['fullpath'] );
		$this->plugin['name'] = $plugin_data['Name'];
	}
454297
function load($plugin_name,$plugin_param = null)
	{
		$path = WEBPATH.'/swoole_plugin/'.$plugin_name.'/Swoole.plugin.php';
		if(file_exists($path))
		{
			require_once($path);
			$this->plugins[$plugin_name] = $swoole_plugin;
		}
		else Error::info('Plugin not Found!',"Plugin file <b>$path</b> not exists!");
	}
445137
protected function setPluginAutoloading()
    {
        foreach ($this->config('plugin.autoloading', []) as $ns => $path) {
            $path = $this->dirPath.'/'.trim($path, '\/');
            $this->loader->addPsr4($ns, $path);
        }

        $this->loader->register();
    }
911437
protected function setWebSafeFileName()
    {
        if ($this->new_file_name == null) {
            $this->setNewFileName();
        }

        // replace multiple spaces to one space.
        $this->new_file_name = preg_replace('#\s+#iu', ' ', $this->new_file_name);
        // replace space to dash.
        $this->new_file_name = str_replace(' ', '-', $this->new_file_name);
        // replace non alpha-numeric to nothing.
        $this->new_file_name = preg_replace('#[^\da-z\-_]#iu', '', $this->new_file_name);
        // replace multiple dashes to one dash.
        $this->new_file_name = preg_replace('#-{2,}#', '-', $this->new_file_name);
    }
751831
protected function setFileName($file)
    {
        if (isset($this->options['thumbnails'])) {
            $thumbs = isset($this->options['changeThumb'])
                ? $this->options['thumbnails'][$this->options['changeThumb']]
                : $this->options['thumbnails'];
            $thumbs = array_values($thumbs);
            $firstThumb = array_shift($thumbs);
            if (isset($firstThumb['name'])) {
                $this->fileName = str_replace(':time',time(),$firstThumb['name']);
                return;
            }
        }
        $this->fileName = $this->createFileName($file);
    }
757039
protected function set_temp_file_path() {
        global $USER, $CFG;
        make_temp_directory('csvimport/' . $USER->id);
        $path = $CFG->tempdir . '/csvimport/' . $USER->id. '/' . $this->filename;
        // Check to see if the file exists, if so delete it.
        if (file_exists($path)) {
            unlink($path);
        }
        $this->path = $path;
    }
25836
public function init()
    {
        $filename = $this->getDirectory().DIRECTORY_SEPARATOR.$this->initFilename;

        if (File::exists($filename)) {
            File::requireOnce($filename);
        }
    }
1317097
protected function setPaths()
    {
        $pathPackage = realpath(__DIR__.'/../../../../');
        $pathBase = realpath(base_path());

        // Set CLI path.
        $this->pathCli = $pathBase.'/vendor/bin/'.$this::CLI_TOOL;
        if (!file_exists($this->pathCli)) {
            $this->pathCli = $pathPackage.'/vendor/bin/'.$this::CLI_TOOL;
        }

        // Set ruleset paths.
        $this->pathRulesetStock = $pathPackage.'/rulesets/'.$this::CLI_TOOL.'.xml';
        $this->pathRulesetLocal = $pathBase.'/'.$this::CLI_TOOL.'.xml';
        $this->pathRulesetLocalLegacy = $pathBase.'/app/'.$this::CLI_TOOL.'.xml';

        // Set active ruleset.
        $this->pathRuleset = $this->pathRulesetStock;
        if (is_readable($this->pathRulesetLocal)) {
            $this->pathRuleset = $this->pathRulesetLocal;
        } elseif (is_readable($this->pathRulesetLocalLegacy)) {
            $this->pathRuleset = $this->pathRulesetLocalLegacy;
        }
    }
848712
def add_loadout_preset(self, file_path: str):
        
        if file_path is not None and os.path.isfile(file_path):
            name = pathlib.Path(file_path).stem
        else:
            name = "new preset"
        if file_path in self.loadout_presets:
            return self.loadout_presets[file_path]
        preset = LoadoutPreset(name, file_path)
        self.loadout_presets[preset.config_path] = preset
        return preset
102775
protected function _setupPaths()
    {
        $paths = Configure::read('App.paths.templates');

        $extraPaths = Configure::read('CrudView.templatePaths');
        if (!empty($extraPaths)) {
            $paths = array_merge($paths, (array)$extraPaths);
        }
        $paths[] = Plugin::classPath('CrudView') . 'Template' . DS;

        Configure::write('App.paths.templates', $paths);
    }
589107
def _add_plugin_paths(self):
        
        base_dir = os.path.join(os.path.dirname(__file__), 'plugins')
        ansible_mitogen.loaders.connection_loader.add_directory(
            os.path.join(base_dir, 'connection')
        )
        ansible_mitogen.loaders.action_loader.add_directory(
            os.path.join(base_dir, 'action')
        )
333268
protected function setPluginHeaders(string $name, array $headers)
    {
        $this->info('Set plugin headers...');

        $path = $this->path($name.'/plugin-name.php');
        $handle = fopen($path, 'r');
        $content = [];

        while (($line = fgets($handle)) !== false) {
            $content[] = $this->parseLine($line, $headers);
        }

        fclose($handle);

        $this->files->put($path, implode('', $content), true);
    }
1257090
public static function init($init_config_files)
    {
        self::$settings = [];
        self::$default_dir = QP_CONFIG_PATH;

        foreach ($init_config_files as $filename) {
            self::addConfigFromFile($filename);
        }
    }
1305923
def set_path(self, file_path):
        
        if not file_path:
            self.read_data = self.memory_read
            self.write_data = self.memory_write
        elif not is_valid(file_path):
            self.write_data(file_path, {})

        self.path = file_path
658089
public function setFileFoot(): void
    {
        // check local service file
        $this->fileFoot = $this->prepareFilePath('foot', false);
        if (!file_exists($this->fileFoot)) {
            // look up for default file
            $this->fileFoot = $this->prepareDefaultFilePath('foot');
        }
    }
305776
protected function loadPluginInfo()
    {
        $this->pluginInfo = array();
        foreach ($this->files as $fileInfo) {
            if ($fileInfo instanceof \SplFileInfo) {
                if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') {
                    $this->addPluginFromFile($fileInfo);
                }
            }
        }
    }
227390
public function setPath(string $path)
    {
        $info = pathinfo($path);

        $this->setLocation($info["dirname"] ?? "");
        $this->setName($info["filename"] ?? "");
    }