Skip to content

Commit fc0cab4

Browse files
committed
Fixed conflicts when multiple versions installed
1 parent 93e4091 commit fc0cab4

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

app/Plugin.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,20 @@ public static function get_wpsac_plugin_option( $key, $group_id = 'options', $ca
275275

276276
}
277277

278+
/**
279+
* Append a field prefix as defined in $config
280+
*
281+
* @param string|null $field_name The string/field to prefix
282+
* @param string $before String to add before the prefix
283+
* @param string $after String to add after the prefix
284+
* @return string Prefixed string/field value
285+
* @since 0.1.0
286+
*/
287+
public static function prefix( $field_name = null, $before = '', $after = '_' ) {
288+
289+
$prefix = $before . self::$config->get( 'prefix' ) . $after;
290+
return $field_name !== null ? $prefix . $field_name : $prefix;
291+
292+
}
293+
278294
}

app/Settings/Network_Settings_Page.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function __construct() {
3030
*/
3131
public function create_network_options_page() {
3232

33-
Container::make( 'network', $this->prefix( self::$config->get( 'network/default_options_container' ) ), __( 'Global Settings', self::$textdomain ) )
33+
$container_name = $this->prefix( self::$config->get( 'network/default_options_container' ) );
34+
Container::make( 'network', $container_name, __( 'Global Settings', self::$textdomain ) )
3435
->set_page_parent( 'settings.php' )
3536
->add_tab( __( 'General', self::$textdomain ), array(
3637
Field::make( 'textarea', $this->prefix( 'network_site_footer' ), __( 'WP Admin Site Footer', self::$textdomain ) )

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"jjgrainger/posttypes": "^2.0",
2323
"tgmpa/tgm-plugin-activation": "^2.6.1",
2424
"tareq1988/wordpress-settings-api-class": "dev-master",
25-
"dmhendricks/wordpress-toolkit": "0.3.0",
25+
"dmhendricks/wordpress-toolkit": "dev-master",
2626
"inc2734/wp-customizer-framework": "^2.3",
2727
"composer/installers": "^1.5"
2828
},

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dependencies": {
99
"php": "5.6",
1010
"carbon_fields": "2.2.0",
11-
"wordpress-toolkit": "0.3.0"
11+
"wordpress-toolkit": "0.3.1"
1212
},
1313
"network": {
1414
"default_options_container": "global_settings"

wordpress-base-plugin.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: WordPress Base Plugin
55
* Plugin URI: https://github.com/dmhendricks/wordpress-base-plugin
66
* Description: A boilerplate for WordPress plugins
7-
* Version: 0.5.1
7+
* Version: 0.5.2
88
* Author: Daniel M. Hendricks
99
* Author URI: https://www.danhendricks.com
1010
* License: GPL-2.0
@@ -34,7 +34,6 @@
3434
if( !defined( 'ABSPATH' ) ) die();
3535

3636
require( __DIR__ . '/vendor/autoload.php' );
37-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3837

3938
// Initialize plugin
4039
new \VendorName\PluginName\Plugin();

0 commit comments

Comments
 (0)