Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
thenickless committed Oct 11, 2024
2 parents d247215 + c041913 commit b4c969a
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 71 deletions.
27 changes: 16 additions & 11 deletions includes/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class Main
*/
protected $pluginFile;

protected $settings;
/**
* The version of the plugin.
* @var string
*/
protected $pluginVersion;

/**
* Assign values to variables.
Expand All @@ -35,6 +39,8 @@ public function __construct($pluginFile)
*/
public function onLoaded()
{
$this->setPluginVersion();

add_action('init', [$this, 'registerAssets']);
add_action('enqueue_block_assets', [$this, 'enqueueAssets']);

Expand All @@ -46,50 +52,49 @@ public function onLoaded()
}

/**
* Get the plugin version from the main plugin file.
* Set the version of the plugin.
* @return string The version of the plugin
*/
protected function getPluginVersion()
protected function setPluginVersion()
{
$pluginData = get_file_data($this->pluginFile, ['Version' => 'Version'], false);
return $pluginData['Version'] ?? '1.0.0';
}
$this->pluginVersion = $pluginData['Version'] ?? '1.0.0';
}

/**
* Register assets.
*/
public function registerAssets()
{
$pluginVersion = $this->getPluginVersion();

// Register scripts and styles
wp_register_script(
'lenny-random-bark',
plugins_url('src/js/random-bark.js', plugin_basename($this->pluginFile)),
['jquery'],
file_exists(plugin_dir_path($this->pluginFile) . 'src/js/random-bark.js') ? filemtime(plugin_dir_path($this->pluginFile) . 'src/js/random-bark.js') : $pluginVersion,
filemtime(plugin_dir_path($this->pluginFile) . 'src/js/random-bark.js') ?: $this->pluginVersion,
true
);

wp_register_style(
'lenny-frontend-style',
plugins_url('build/frontend.css', plugin_basename($this->pluginFile)),
[],
file_exists(plugin_dir_path($this->pluginFile) . 'build/frontend.css') ? filemtime(plugin_dir_path($this->pluginFile) . 'build/frontend.css') : $pluginVersion
filemtime(plugin_dir_path($this->pluginFile) . 'build/frontend.css') ?: $this->pluginVersion
);

wp_register_script(
'lenny-block-editor-script',
plugins_url('build/block.js', plugin_basename($this->pluginFile)),
['wp-blocks', 'wp-element', 'wp-editor'],
file_exists(plugin_dir_path($this->pluginFile) . 'build/block.js') ? filemtime(plugin_dir_path($this->pluginFile) . 'build/block.js') : $pluginVersion,
filemtime(plugin_dir_path($this->pluginFile) . 'build/block.js') ?: $this->pluginVersion,
true
);

wp_register_style(
'lenny-block-editor-style',
plugins_url('build/editor.css', plugin_basename($this->pluginFile)),
[],
file_exists(plugin_dir_path($this->pluginFile) . 'build/editor.css') ? filemtime(plugin_dir_path($this->pluginFile) . 'build/editor.css') : $pluginVersion
filemtime(plugin_dir_path($this->pluginFile) . 'build/editor.css') ?: $this->pluginVersion
);
}

Expand Down
2 changes: 1 addition & 1 deletion languages/rrze-hello-lenny-de_DE.l10n.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
return ['project-id-version'=>'RRZE Hello Lenny','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-10-11 06:56+0000','po-revision-date'=>'2024-10-11 06:57+0000','last-translator'=>'','language-team'=>'German','language'=>'de_DE','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.2','x-domain'=>'rrze-hello-lenny','messages'=>['Wouf!'=>'Wuff!']];
return ['project-id-version'=>'RRZE Hello Lenny','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-10-11 06:56+0000','po-revision-date'=>'2024-10-11 15:53+0000','last-translator'=>'RRZE Webteam <webmaster@fau.de>','language-team'=>'Deutsch','language'=>'de_DE','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.2','x-domain'=>'rrze-hello-lenny','messages'=>['A plugin inspired by Hello Dolly, using both a shortcode and a Gutenberg block.'=>'Ein Plugin, inspiriert von Hello Dolly, das sowohl einen Shortcode als auch einen Gutenberg-Block verwendet.','https://blogs.fau.de/webworking/'=>'https://blogs.fau.de/webworking/','https://github.com/RRZE-Webteam/rrze-hello-lenny/'=>'https://github.com/RRZE-Webteam/rrze-hello-lenny/','Plugins: %1$s: %2$s'=>'Plugins: %1$s: %2$s','RRZE Hello Lenny'=>'RRZE Hallo Lenny','RRZE Webteam'=>'RRZE-Webteam','The server is running PHP version %1$s. The Plugin requires at least PHP version %2$s.'=>'Auf dem Server läuft PHP Version %1$s. Das Plugin erfordert mindestens PHP Version %2$s.','The server is running WordPress version %1$s. The Plugin requires at least WordPress version %2$s.'=>'Auf dem Server läuft WordPress Version %1$s. Das Plugin erfordert mindestens WordPress Version %2$s.','Wouf!'=>'Wuff!']];
Binary file modified languages/rrze-hello-lenny-de_DE.mo
Binary file not shown.
47 changes: 40 additions & 7 deletions languages/rrze-hello-lenny-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ msgstr ""
"Project-Id-Version: RRZE Hello Lenny\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-11 06:56+0000\n"
"PO-Revision-Date: 2024-10-11 06:57+0000\n"
"Last-Translator: \n"
"Language-Team: German\n"
"PO-Revision-Date: 2024-10-11 15:53+0000\n"
"Last-Translator: RRZE Webteam <webmaster@fau.de>\n"
"Language-Team: Deutsch\n"
"Language: de_DE\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
Expand All @@ -20,19 +20,52 @@ msgid ""
"A plugin inspired by Hello Dolly, using both a shortcode and a Gutenberg "
"block."
msgstr ""
"Ein Plugin, inspiriert von Hello Dolly, das sowohl einen Shortcode als auch "
"einen Gutenberg-Block verwendet."

#. Author URI of the plugin
msgid "https://blogs.fau.de/webworking/"
msgstr ""
msgstr "https://blogs.fau.de/webworking/"

#. URI of the plugin
msgid "https://github.com/RRZE-Webteam/rrze-hello-lenny/"
msgstr "https://github.com/RRZE-Webteam/rrze-hello-lenny/"

#. 1: The plugin name, 2: The error string.
#: rrze-hello-lenny.php:104 rrze-hello-lenny.php:135
#, php-format
msgid "Plugins: %1$s: %2$s"
msgstr "Plugins: %1$s: %2$s"

#. Name of the plugin
msgid "RRZE Hello Lenny"
msgstr ""
msgstr "RRZE Hallo Lenny"

#. Author of the plugin
msgid "RRZE-Webteam"
#| msgid "RRZE-Webteam"
msgid "RRZE Webteam"
msgstr "RRZE-Webteam"

#. 1: Server PHP version number, 2: Required PHP version number.
#: rrze-hello-lenny.php:78
#, php-format
msgid ""
"The server is running PHP version %1$s. The Plugin requires at least PHP "
"version %2$s."
msgstr ""
"Auf dem Server läuft PHP Version %1$s. Das Plugin erfordert mindestens PHP "
"Version %2$s."

#. 1: Server WordPress version number, 2: Required WordPress version number.
#: rrze-hello-lenny.php:85
#, php-format
msgid ""
"The server is running WordPress version %1$s. The Plugin requires at least "
"WordPress version %2$s."
msgstr ""
"Auf dem Server läuft WordPress Version %1$s. Das Plugin erfordert mindestens "
"WordPress Version %2$s."

#: rrze-hello-lenny.php:26 rrze-hello-lenny.php:81
#: includes/Shortcode.php:45
msgid "Wouf!"
msgstr "Wuff!"
2 changes: 1 addition & 1 deletion languages/rrze-hello-lenny-de_DE_formal.l10n.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
return ['project-id-version'=>'RRZE Hello Lenny','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-10-11 06:56+0000','po-revision-date'=>'2024-10-11 06:57+0000','last-translator'=>'','language-team'=>'German (Formal)','language'=>'de_DE_formal','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.2','x-domain'=>'rrze-hello-lenny','messages'=>['Wouf!'=>'Wuff!']];
return ['project-id-version'=>'RRZE Hello Lenny','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-10-11 06:56+0000','po-revision-date'=>'2024-10-11 15:52+0000','last-translator'=>'RRZE Webteam <webmaster@fau.de>','language-team'=>'Deutsch (Sie)','language'=>'de_DE_formal','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.2','x-domain'=>'rrze-hello-lenny','messages'=>['A plugin inspired by Hello Dolly, using both a shortcode and a Gutenberg block.'=>'Ein Plugin, inspiriert von Hello Dolly, das sowohl einen Shortcode als auch einen Gutenberg-Block verwendet.','https://blogs.fau.de/webworking/'=>'https://blogs.fau.de/webworking/','https://github.com/RRZE-Webteam/rrze-hello-lenny/'=>'https://github.com/RRZE-Webteam/rrze-hello-lenny/','Plugins: %1$s: %2$s'=>'Plugins: %1$s: %2$s','RRZE Hello Lenny'=>'RRZE Hallo Lenny','RRZE Webteam'=>'RRZE-Webteam','The server is running PHP version %1$s. The Plugin requires at least PHP version %2$s.'=>'Auf dem Server läuft PHP Version %1$s. Das Plugin erfordert mindestens PHP Version %2$s.','The server is running WordPress version %1$s. The Plugin requires at least WordPress version %2$s.'=>'Auf dem Server läuft WordPress Version %1$s. Das Plugin erfordert mindestens WordPress Version %2$s.','Wouf!'=>'Wuff!']];
Binary file modified languages/rrze-hello-lenny-de_DE_formal.mo
Binary file not shown.
47 changes: 40 additions & 7 deletions languages/rrze-hello-lenny-de_DE_formal.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ msgstr ""
"Project-Id-Version: RRZE Hello Lenny\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-11 06:56+0000\n"
"PO-Revision-Date: 2024-10-11 06:57+0000\n"
"Last-Translator: \n"
"Language-Team: German (Formal)\n"
"PO-Revision-Date: 2024-10-11 15:52+0000\n"
"Last-Translator: RRZE Webteam <webmaster@fau.de>\n"
"Language-Team: Deutsch (Sie)\n"
"Language: de_DE_formal\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
Expand All @@ -20,19 +20,52 @@ msgid ""
"A plugin inspired by Hello Dolly, using both a shortcode and a Gutenberg "
"block."
msgstr ""
"Ein Plugin, inspiriert von Hello Dolly, das sowohl einen Shortcode als auch "
"einen Gutenberg-Block verwendet."

#. Author URI of the plugin
msgid "https://blogs.fau.de/webworking/"
msgstr ""
msgstr "https://blogs.fau.de/webworking/"

#. URI of the plugin
msgid "https://github.com/RRZE-Webteam/rrze-hello-lenny/"
msgstr "https://github.com/RRZE-Webteam/rrze-hello-lenny/"

#. 1: The plugin name, 2: The error string.
#: rrze-hello-lenny.php:104 rrze-hello-lenny.php:135
#, php-format
msgid "Plugins: %1$s: %2$s"
msgstr "Plugins: %1$s: %2$s"

#. Name of the plugin
msgid "RRZE Hello Lenny"
msgstr ""
msgstr "RRZE Hallo Lenny"

#. Author of the plugin
msgid "RRZE-Webteam"
#| msgid "RRZE-Webteam"
msgid "RRZE Webteam"
msgstr "RRZE-Webteam"

#. 1: Server PHP version number, 2: Required PHP version number.
#: rrze-hello-lenny.php:78
#, php-format
msgid ""
"The server is running PHP version %1$s. The Plugin requires at least PHP "
"version %2$s."
msgstr ""
"Auf dem Server läuft PHP Version %1$s. Das Plugin erfordert mindestens PHP "
"Version %2$s."

#. 1: Server WordPress version number, 2: Required WordPress version number.
#: rrze-hello-lenny.php:85
#, php-format
msgid ""
"The server is running WordPress version %1$s. The Plugin requires at least "
"WordPress version %2$s."
msgstr ""
"Auf dem Server läuft WordPress Version %1$s. Das Plugin erfordert mindestens "
"WordPress Version %2$s."

#: rrze-hello-lenny.php:26 rrze-hello-lenny.php:81
#: includes/Shortcode.php:45
msgid "Wouf!"
msgstr "Wuff!"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4c969a

Please sign in to comment.