Skip to content

Commit 071a9a0

Browse files
committed
Minor syntax changes
1 parent e8bbacd commit 071a9a0

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

app/CPT.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function __construct() {
1212
$this->add_post_type_client();
1313

1414
// Hide unnecessary publishing options like Draft, visibility, etc.
15-
add_action( 'admin_head-post.php', array(&$this, 'hide_publishing_actions') );
16-
add_action( 'admin_head-post-new.php', array(&$this, 'hide_publishing_actions') );
15+
add_action( 'admin_head-post.php', array( $this, 'hide_publishing_actions' ) );
16+
add_action( 'admin_head-post-new.php', array( $this, 'hide_publishing_actions' ) );
1717

1818
}
1919

@@ -47,17 +47,17 @@ private function add_post_type_client() {
4747
Container::make('post_meta', 'Client Details')
4848
->show_on_post_type($cpt->postTypeName)
4949
->add_fields(array(
50-
Field::make('text', self::$prefix.'name', 'Name'),
51-
Field::make('text', self::$prefix.'company', 'Company'),
50+
Field::make('text', $this->prefix( 'name' ), 'Name'),
51+
Field::make('text', $this->prefix( 'company' ), 'Company'),
5252
)
5353
);
5454

5555
Container::make('post_meta', 'Contact Info')
5656
->show_on_post_type($cpt->postTypeName)
5757
->add_fields(array(
58-
Field::make('text', self::$prefix.'url', 'Web Site'),
59-
Field::make('text', self::$prefix.'phone', 'Phone Number'),
60-
Field::make('textarea', self::$prefix.'address', "Services")->set_rows(4)
58+
Field::make('text', $this->prefix( 'url' ), 'Web Site'),
59+
Field::make('text', $this->prefix( 'phone' ), 'Phone Number'),
60+
Field::make('textarea', $this->prefix( 'address' ), 'Services')->set_rows(4)
6161
)
6262
);
6363

app/Core.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Core extends Plugin {
66
function __construct() {
77

88
// Add page, post type and parent classes to <body> tag for selector targeting
9-
add_filter( 'body_class', array(&$this, 'add_body_classes') );
9+
add_filter( 'body_class', array( &$this, 'add_body_classes' ) );
1010

1111
// Remove Emoji code from header
1212
if( $this->get_plugin_option( 'remove_header_emojicons' ) ) {
@@ -23,19 +23,20 @@ function __construct() {
2323
*
2424
* @param array $classes An array of *current* body_class classes
2525
* @return array Modified array of body classes including new ones
26+
* @since 0.1.0
2627
*/
2728
public function add_body_classes($classes) {
2829
$parent_slug = Utils::get_parent_slug(true);
2930
$categories = is_single() ? Utils::get_post_categories(true) : array();
3031

3132
// Add page, parent and post-type classes, if available
32-
$classes[] = 'page-'.Utils::get_page_slug();
33-
if($parent_slug) $classes[] = 'parent-'.$parent_slug;
34-
$classes[] = 'post-type-'.get_post_type();
33+
$classes[] = 'page-' . Utils::get_page_slug();
34+
if($parent_slug) $classes[] = 'parent-' . $parent_slug;
35+
$classes[] = 'post-type-' . get_post_type();
3536

3637
// Add category slugs
3738
foreach($categories as $cat) {
38-
$classes[] = 'category-'.$cat;
39+
$classes[] = 'category-' . $cat;
3940
}
4041

4142
return $classes;

app/Shortcodes.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ class Shortcodes extends Plugin {
66
function __construct() {
77

88
// Usage: [hello name="Daniel"]
9-
if(!shortcode_exists('hello')) {
10-
add_shortcode('hello', array(&$this, 'hello_world'));
9+
if( !shortcode_exists( 'hello' ) ) {
10+
add_shortcode( 'hello', array( $this, 'hello_world' ) );
1111
}
1212

1313
}
1414

1515
/**
1616
* A short code the returns "Hello {$name}!", if provided
17+
*
18+
* @since 0.1.0
1719
*/
18-
private static function hello_world( $atts ) {
20+
public static function hello_world( $atts ) {
1921
$atts = shortcode_atts(array(
2022
'name' => 'world'
2123
), $atts, 'hello');
2224

23-
return 'Hello '.$atts['name'].'!';
25+
return 'Hello ' . $atts['name'] . '!';
2426
}
2527

2628
}

app/WidgetLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66
class WidgetLoader extends Plugin {
77

8+
public static $prefix;
9+
810
function __construct() {
911

12+
self::$prefix = $this->prefix();
13+
1014
// Register widgets
1115
add_action( 'widgets_init', function() {
1216
register_widget( new My_Widget_Class() );

0 commit comments

Comments
 (0)