Skip to content

Commit 9d4d8a5

Browse files
committed
Added before/after strings to prefix()
1 parent 6a715a7 commit 9d4d8a5

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

app/Plugin.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,15 @@ public static function get_plugin_option( $key, $cache = true ) {
202202
/**
203203
* A wrapper for the plugin's data fiala prefix as defined in $config
204204
*
205-
* @param string|null $str The string/field to prefix
205+
* @param string|null $field_name The string/field to prefix
206+
* @param string $before String to add before the prefix
207+
* @param string $after String to add after the prefix
206208
* @return string Prefixed string/field value
207209
* @since 0.2.0
208210
*/
209-
public static function prefix( $field_name = null ) {
210-
return $field_name !== null ? self::$config->get( 'prefix' ) . $field_name : self::$config->get( 'prefix' );
211+
public static function prefix( $field_name = null, $before = '', $after = '_' ) {
212+
$prefix = $before . self::$config->get( 'prefix' ) . $after;
213+
return $field_name !== null ? $prefix . $field_name : $prefix;
211214
}
212215

213216
/**

plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"prefix": "myplugin_",
3-
"short_name": "Base Plugin",
2+
"prefix": "myplugin",
3+
"short_name": "My Plugin",
44
"object_cache": {
55
"group": "my_plugin_cache",
66
"expire_hours": 72

0 commit comments

Comments
 (0)