diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f0602c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +### vscode ### +.vscode/ +### NetBeans ### +**/nbproject/ +### PhpStorm ### +.idea/ +### macOS ### +.DS_Store +### Node ### +node_modules/ +### Tmp ### +_tmp/ diff --git a/composer.json b/composer.json index bc52db3..4f0b461 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "rrze/wp", "description": "A general purpose library for WordPress.", + "version": "1.0.0", "type": "library", "keywords": [ "wordpress" @@ -12,6 +13,11 @@ "name": "Rolf v. d. Forst", "email": "rolf.v.d.forst@fau.de", "homepage": "https://www.rrze.fau.de" + }, + { + "name": "Benjamin Klemencic", + "email": "benjamin.klemencic@fau.de", + "homepage": "https://www.rrze.fau.de" } ], "require": { diff --git a/src/Plugin.php b/src/Plugin.php index 80db0cb..7d760a4 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -116,7 +116,7 @@ public function setDirectory(): object */ public function getPath(string $path = ''): string { - return $this->directory . ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + return $this->directory . ($path ? trim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : ''); } /** @@ -127,7 +127,7 @@ public function getPath(string $path = ''): string */ public function getUrl(string $path = ''): string { - return $this->url . ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + return $this->url . ($path ? trim($path, '/') . '/' : ''); } /** @@ -137,7 +137,7 @@ public function getUrl(string $path = ''): string */ public function setUrl(): object { - $this->url = rtrim(plugin_dir_url($this->pluginFile), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $this->url = rtrim(plugin_dir_url($this->pluginFile), '/') . '/'; return $this; } diff --git a/src/Helper.php b/src/Utils.php similarity index 98% rename from src/Helper.php rename to src/Utils.php index f1685ff..5a5484e 100644 --- a/src/Helper.php +++ b/src/Utils.php @@ -4,7 +4,7 @@ defined('ABSPATH') || exit; -class Helper +class Utils { public static function debug($input, string $level = 'i') { diff --git a/src/languages/rrze-wp.pot b/src/languages/rrze-wp.pot new file mode 100644 index 0000000..dd077f5 --- /dev/null +++ b/src/languages/rrze-wp.pot @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2022-11-17T09:13:39+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.7.1\n" +"X-Domain: rrze-wp\n"