Skip to content

Commit

Permalink
Moved and methods to wordpress-toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
dmhendricks committed Jan 18, 2018
1 parent ad777b8 commit 27c67a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ Release changes are noted on the [Releases](https://github.com/dmhendricks/wordp

#### Branch: `master`

* None since release
* Extended base class as WordPress Toolkit
* Moved `is_ajax()` and `prefix()` methods to wordpress-toolkit

## Screenshot

Expand Down
26 changes: 1 addition & 25 deletions app/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Carbon_Fields\Field;
use Config;

class Plugin {
class Plugin extends \WordPress_ToolKit\ToolKit {

public static $textdomain;
public static $config;
Expand Down Expand Up @@ -245,20 +245,6 @@ public static function get_wpsac_plugin_option( $key, $group_id = 'options', $ca

}

/**
* A wrapper for the plugin's data fiala prefix as defined in $config
*
* @param string|null $field_name The string/field to prefix
* @param string $before String to add before the prefix
* @param string $after String to add after the prefix
* @return string Prefixed string/field value
* @since 0.2.0
*/
public static function prefix( $field_name = null, $before = '', $after = '_' ) {
$prefix = $before . self::$config->get( 'prefix' ) . $after;
return $field_name !== null ? $prefix . $field_name : $prefix;
}

/**
* Returns true if WP_ENV is anything other than 'development' or 'staging'.
* Useful for determining whether or not to enqueue a minified or non-
Expand All @@ -271,14 +257,4 @@ public static function is_production() {
return ( !defined( 'WP_ENV' ) || ( defined('WP_ENV' ) && !in_array( WP_ENV, array( 'development', 'staging' ) ) ) );
}

/**
* Returns true if request is via Ajax.
*
* @return bool
* @since 0.1.0
*/
public function is_ajax() {
return defined( 'DOING_AJAX' ) && DOING_AJAX;
}

}

0 comments on commit 27c67a8

Please sign in to comment.