Skip to content

Commit

Permalink
Updated compatibility for Carbon Fields 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dmhendricks committed Nov 18, 2017
1 parent a4e76cd commit eaf13e3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Release changes are noted on the [Releases](https://github.com/dmhendricks/wordp

* Added Carbon Fields [Serialized Datastore](https://github.com/dmhendricks/wordpress-base-plugin/wiki/Features-&-Customization#serialized-data-store) example
* Fixed bugs with example widget scope
* Updated compatibility for Carbon Fields 2.1.1

## Credits

Expand Down
8 changes: 4 additions & 4 deletions app/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static function get_post_categories($as_slugs = false, $post_id = null) {
* @return string
* @since 0.1.0
*/
public function get_script_version( $script, $return_minified = false, $script_version = null ) {
public static function get_script_version( $script, $return_minified = false, $script_version = null ) {
$version = $script_version ?: self::$config->get( 'plugin/meta/Version' );
if( self::is_production() ) return $version;

Expand All @@ -185,9 +185,9 @@ public function get_script_version( $script, $return_minified = false, $script_v
* @return string The URL or path to minified or regular $script.
* @since 0.1.0
*/
public function get_script_path( $script, $return_minified = true, $return_url = false ) {
public static function get_script_path( $script, $return_minified = true, $return_url = false ) {
$script = trim( $script, '/' );
if( $return_minified && strpos( $script, '.' ) && $this->is_production() ) {
if( $return_minified && strpos( $script, '.' ) && self::is_production() ) {
$script_parts = explode( '.', $script );
$script_extension = end( $script_parts );
array_pop( $script_parts );
Expand All @@ -204,7 +204,7 @@ public function get_script_path( $script, $return_minified = true, $return_url =
* @param bool
* @since 0.1.0
*/
public function get_script_url( $script, $return_minified = false ) {
public static function get_script_url( $script, $return_minified = false ) {
return self::get_script_path( $script, $return_minified, true );
}

Expand Down
6 changes: 3 additions & 3 deletions app/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function init() {
}

if( $this->verify_dependencies( 'carbon_fields' ) === true ) {
add_action( 'carbon_fields_loaded', array( $this, 'load_plugin' ));
add_action( 'carbon_fields_fields_registered', array( $this, 'load_plugin' ));
}

}
Expand Down Expand Up @@ -206,7 +206,7 @@ public function get_plugin_option( $key, $cache = true ) {
* @return string Prefixed string/field value
* @since 0.2.0
*/
public function prefix( $field_name = null ) {
public static function prefix( $field_name = null ) {
return $field_name !== null ? self::$config->get( 'prefix' ) . $field_name : self::$config->get( 'prefix' );
}

Expand All @@ -218,7 +218,7 @@ public function prefix( $field_name = null ) {
* @return bool
* @since 0.1.0
*/
public function is_production() {
public static function is_production() {
return ( !defined( 'WP_ENV' ) || ( defined('WP_ENV' ) && !in_array( WP_ENV, array('development', 'staging') ) ) );
}

Expand Down
4 changes: 2 additions & 2 deletions app/PostTypes/Clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public function add_post_type_client() {

// Add fields
Container::make( 'post_meta', __('Client Details', self::$textdomain ) )
->show_on_post_type( $cpt->postTypeName )
->show_on_post_type( $cpt->name )
->add_fields( array(
Field::make( 'text', $this->prefix( 'name' ), __( 'Name', self::$textdomain ) ),
Field::make( 'text', $this->prefix( 'company' ), __( 'Company', self::$textdomain ) ),
)
);
Container::make( 'post_meta', 'Contact Info' )
->show_on_post_type( $cpt->postTypeName )
->show_on_post_type( $cpt->name )
->add_fields( array(
Field::make( 'text', $this->prefix( 'url' ), __( 'Web Site', self::$textdomain ) ),
Field::make( 'text', $this->prefix( 'phone' ), __( 'Phone Number', self::$textdomain ) ),
Expand Down
2 changes: 1 addition & 1 deletion app/Settings/Carbon_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function create_tabbed_options_page() {
*/
private function create_single_options_page() {

Container::make( 'theme_options', self::$config->get( 'plugin/meta/Name' ) )
$container = Container::make( 'theme_options', self::$config->get( 'plugin/meta/Name' ) )
->set_page_parent( 'options-general.php' )
->add_fields( array(
Field::make( 'text', $this->prefix( 'your_name' ), __( 'Your Name', self::$textdomain ) ),
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"php": ">=5.6.0",
"jjgrainger/posttypes": "dev-master",
"tgmpa/tgm-plugin-activation": "^2.6.0",
"tgmpa/tgm-plugin-activation": "^2.6.1",
"tareq1988/wordpress-settings-api-class": "dev-master",
"dmhendricks/wordpress-toolkit": "dev-master",
"composer/installers": "^1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: hendridm
Tags: wordpress,base,plugin,boilerplate,composer,carbonfields
Donate link: https://paypal.me/danielhendricks
Requires at least: 4.0
Tested up to: 4.8.2
Tested up to: 4.9
Stable tag: 0.3.0
License: GPL-2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down

0 comments on commit eaf13e3

Please sign in to comment.