Skip to content

Commit 6cdc4bd

Browse files
authored
Merge pull request #36 from justcoded/develop
Code styles
2 parents 706d6a0 + 1c63bed commit 6cdc4bd

30 files changed

+164
-153
lines changed

assets/js/load_more.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
jQuery(document).ready(function () {
22
initLoadMore();
3-
})
3+
});
44

55
function initLoadMore() {
66
var loading = false;

assets/js/widget-preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if ( ! $next.next().length ) {
1818
$(this).hide();
1919
}
20-
})
20+
});
2121
$(document).on('click', '.preview-nav .prev', function(){
2222
var $current = $('.preview-item:visible');
2323
var $prev = $current.prev();

framework/Autoload.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ class Autoload {
1313
protected $app_namespace;
1414

1515
/**
16-
* Dirname path to search classes
16+
* Directory name path to search classes
1717
*
1818
* @var string
1919
*/
2020
protected $app_path;
2121

2222
/**
23-
* Class contructor
23+
* Class constructor
2424
* register SPL autoload callback functions for App and framework
2525
*
2626
* @param string $app_namespace App namespace.
27-
* @param string $app_path App dirpath.
27+
* @param string $app_path App directory path.
2828
*/
2929
public function __construct( $app_namespace, $app_path ) {
3030
$this->app_namespace = $app_namespace;
@@ -61,7 +61,7 @@ protected function load_class( $class_name, $namespace, $dir_path ) {
6161
$path = $dir_path . '/' . trim( $class_path, '/' ) . '.php';
6262

6363
if ( is_file( $path ) ) {
64-
require_once( $path );
64+
require_once $path;
6565
}
6666
}
6767
}

framework/Objects/Meta.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/**
66
* Meta is the base class for acquiring data from custom fields.
77
*/
8-
98
abstract class Meta {
109

1110
/**
@@ -143,10 +142,10 @@ public function get_value( $field_name, $object_id = null, $format_value = true
143142
throw new \Exception( get_class( $this ) . "::get_value() : Unsupported custom fields plugin \"{$this->custom_fields_plugin}\"" );
144143
}
145144

146-
$this->_meta[ $object_id ][ $field_name ] = $value;
145+
static::$_meta[ $object_id ][ $field_name ] = $value;
147146
}
148147

149-
return $this->_meta[ $object_id ][ $field_name ];
148+
return static::$_meta[ $object_id ][ $field_name ];
150149
}
151150

152151
}

framework/Objects/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function __unset( $name ) {
144144

145145
/**
146146
* Run query and remember it to cache
147-
* In this way you can use magic getter withour reseting query
147+
* In this way you can use magic getter without query reset
148148
*
149149
* @param array $params Usual WP_Query params array.
150150
* @param string $method Cache key.

framework/Objects/Post_Type.php

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2+
23
namespace JustCoded\WP\Framework\Objects;
34

4-
use JustCoded\WP\Framework\Web\View;
5-
use JustCoded\WP\Framework\Web\Views_Rule;
65
use JustCoded\WP\Framework\Supports\FakerPress;
76

87
/**
@@ -30,45 +29,45 @@ abstract class Post_Type {
3029
*/
3130
public static $SLUG;
3231

33-
const STATUS_ANY = 'any';
34-
const STATUS_DRAFT = 'draft';
35-
const STATUS_PENDING = 'pending';
36-
const STATUS_PUBLISH = 'publish';
37-
const STATUS_FUTURE = 'future';
32+
const STATUS_ANY = 'any';
33+
const STATUS_DRAFT = 'draft';
34+
const STATUS_PENDING = 'pending';
35+
const STATUS_PUBLISH = 'publish';
36+
const STATUS_FUTURE = 'future';
3837
const STATUS_AUTO_DRAFT = 'auto-draft';
39-
const STATUS_PRIVATE = 'private';
40-
const STATUS_INHERIT = 'inherit';
38+
const STATUS_PRIVATE = 'private';
39+
const STATUS_INHERIT = 'inherit';
4140

42-
const SORT_ASC = 'asc';
41+
const SORT_ASC = 'asc';
4342
const SORT_DESC = 'desc';
4443

45-
const ORDERBY_NONE = 'none';
46-
const ORDERBY_ID = 'ID';
47-
const ORDERBY_AUTHOR = 'author';
48-
const ORDERBY_TITLE = 'title';
49-
const ORDERBY_SLUG = 'name';
50-
const ORDERBY_TYPE = 'type';
51-
const ORDERBY_DATE = 'date';
52-
const ORDERBY_MODIFIED = 'modified';
53-
const ORDERBY_PARENT = 'parent';
54-
const ORDERBY_RAND = 'rand';
55-
const ORDERBY_COMMENTS = 'comment_count';
56-
const ORDERBY_WEIGHT = 'menu_order';
57-
const ORDERBY_META = 'meta_value';
44+
const ORDERBY_NONE = 'none';
45+
const ORDERBY_ID = 'ID';
46+
const ORDERBY_AUTHOR = 'author';
47+
const ORDERBY_TITLE = 'title';
48+
const ORDERBY_SLUG = 'name';
49+
const ORDERBY_TYPE = 'type';
50+
const ORDERBY_DATE = 'date';
51+
const ORDERBY_MODIFIED = 'modified';
52+
const ORDERBY_PARENT = 'parent';
53+
const ORDERBY_RAND = 'rand';
54+
const ORDERBY_COMMENTS = 'comment_count';
55+
const ORDERBY_WEIGHT = 'menu_order';
56+
const ORDERBY_META = 'meta_value';
5857
const ORDERBY_META_NUMERIC = 'meta_value_num';
59-
const ORDERBY_POST_IN = 'post__in';
58+
const ORDERBY_POST_IN = 'post__in';
6059

61-
const SUPPORTS_TITLE = 'title';
62-
const SUPPORTS_EDITOR = 'editor';
63-
const SUPPORTS_AUTHOR = 'author';
60+
const SUPPORTS_TITLE = 'title';
61+
const SUPPORTS_EDITOR = 'editor';
62+
const SUPPORTS_AUTHOR = 'author';
6463
const SUPPORTS_FEATURED_IMAGE = 'thumbnail';
65-
const SUPPORTS_EXCERPT = 'excerpt';
66-
const SUPPORTS_TRACKBACKS = 'trackbacks';
67-
const SUPPORTS_CUSTOM_FIELDS = 'custom-fields';
68-
const SUPPORTS_COMMENTS = 'comments'; // (also will see comment count balloon on edit screen)
69-
const SUPPORTS_REVISIONS = 'revisions';
70-
const SUPPORTS_ORDER = 'page-attributes'; // (menu order, hierarchical must be true to show Parent option)
71-
const SUPPORTS_POST_FORMATS = 'post-formats';
64+
const SUPPORTS_EXCERPT = 'excerpt';
65+
const SUPPORTS_TRACKBACKS = 'trackbacks';
66+
const SUPPORTS_CUSTOM_FIELDS = 'custom-fields';
67+
const SUPPORTS_COMMENTS = 'comments'; // (also will see comment count balloon on edit screen)
68+
const SUPPORTS_REVISIONS = 'revisions';
69+
const SUPPORTS_ORDER = 'page-attributes'; // (menu order, hierarchical must be true to show Parent option)
70+
const SUPPORTS_POST_FORMATS = 'post-formats';
7271

7372
/**
7473
* Single Post Type label
@@ -266,29 +265,24 @@ public function register() {
266265
$labels = array_merge( $labels, $this->labels );
267266

268267
$args = array(
269-
'labels' => $labels,
270-
'hierarchical' => $this->is_hierarchical,
271-
268+
'labels' => $labels,
269+
'hierarchical' => $this->is_hierarchical,
272270
'public' => $this->has_single,
273271
'publicly_queryable' => $this->has_single || $this->is_searchable || $this->redirect,
274272
'show_in_nav_menus' => $this->has_single,
275273
'exclude_from_search' => ! $this->is_searchable,
276274
'has_archive' => $this->has_archive,
277-
278-
'show_ui' => ! empty( $this->has_admin_menu ),
279-
'show_in_menu' => $this->has_admin_menu,
280-
'menu_position' => $this->admin_menu_pos,
281-
'menu_icon' => $this->admin_menu_icon,
282-
283-
'capability_type' => $this->admin_capability,
284-
285-
'supports' => $this->supports,
286-
287-
'rewrite' => array(
275+
'show_ui' => ! empty( $this->has_admin_menu ),
276+
'show_in_menu' => $this->has_admin_menu,
277+
'menu_position' => $this->admin_menu_pos,
278+
'menu_icon' => $this->admin_menu_icon,
279+
'capability_type' => $this->admin_capability,
280+
'supports' => $this->supports,
281+
'rewrite' => array(
288282
'slug' => $this::$SLUG,
289283
'with_front' => ( ! $this->rewrite_singular || $this->redirect ),
290284
),
291-
'query_var' => $this->query_var,
285+
'query_var' => $this->query_var,
292286
);
293287

294288
if ( ! empty( $this->taxonomies ) && is_array( $this->taxonomies ) ) {
@@ -323,16 +317,16 @@ public function template_redirect() {
323317
* By default point all inner CPT pages to views/{cpt}/single.php
324318
* You can write your own rules here
325319
*
326-
* @param string $template Standard template file to be loaded.
320+
* @param string $template Standard template file to be loaded.
327321
*
328-
* @return string Modified template file path
322+
* @return string Modified template file path
329323
*/
330324
public function views( $template ) {
331325
/**
332326
* Example of overwrite:
333327
* if ( is_singular( $this::$ID ) ) {
334328
* $template = View::locate('section/template');
335-
* }
329+
* }
336330
*/
337331

338332
return $template;
@@ -344,4 +338,4 @@ public function views( $template ) {
344338
public function init_faker() {
345339
new FakerPress( $this );
346340
}
347-
}
341+
}

framework/Objects/Taxonomy.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,18 @@ public function register() {
185185
);
186186

187187
$args = array(
188-
'labels' => $labels,
189-
'hierarchical' => $this->is_hierarchical,
190-
191-
'public' => $this->has_single,
192-
'show_in_nav_menus' => $this->has_single,
193-
194-
'show_tagcloud' => $this->has_tag_cloud,
195-
188+
'labels' => $labels,
189+
'hierarchical' => $this->is_hierarchical,
190+
'public' => $this->has_single,
191+
'show_in_nav_menus' => $this->has_single,
192+
'show_tagcloud' => $this->has_tag_cloud,
196193
'show_ui' => $this->has_admin_menu,
197194
'show_admin_column' => $this->admin_posts_column,
198195
'show_in_quick_edit' => $this->is_quick_editable,
199-
200-
'query_var' => $this->query_var,
201-
'rewrite' => array(
202-
'slug' => $this::$SLUG,
203-
'with_front' => ! $this->rewrite_singular,
196+
'query_var' => $this->query_var,
197+
'rewrite' => array(
198+
'slug' => $this::$SLUG,
199+
'with_front' => ! $this->rewrite_singular,
204200
'hierarchical' => $this->rewrite_hierarchical,
205201
),
206202
);

framework/Page_Builder/v25/Fields/Field_Select_Posts.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ protected function render_field( $value, $instance ) {
3131
] );
3232
}
3333
?>
34-
<select name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
34+
<select name="<?php echo esc_attr( $this->element_name ); ?>" id="<?php echo esc_attr( $this->element_id ); ?>"
3535
class="widefat jc-widget-field-select-posts"
3636
multiple="multiple"
3737
data-post_types="<?php echo esc_attr( $this->post_types ); ?>"
3838
>
39-
<?php if ( ! empty( $posts ) ) : foreach ( $posts as $post ) : ?>
39+
<?php if ( ! empty( $posts ) ) : ?>
40+
<?php foreach ( $posts as $post ) : ?>
4041
<option value="<?php echo esc_attr( $post->ID ); ?>" selected="selected">
4142
<?php echo esc_html( $this->get_post_caption( $post ) ); ?>
4243
</option>
43-
<?php endforeach; endif; ?>
44+
<?php endforeach; ?>
45+
<?php endif; ?>
4446
</select>
4547
<?php
4648
}

framework/Page_Builder/v25/Fields/Field_Select_Terms.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ protected function render_field( $value, $instance ) {
3232
] );
3333
}
3434
?>
35-
<select name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
35+
<select name="<?php echo esc_attr( $this->element_name ); ?>" id="<?php echo esc_attr( $this->element_id ); ?>"
3636
class="widefat jc-widget-field-select-posts"
3737
multiple="multiple"
3838
data-taxonomies="<?php echo esc_attr( $this->taxonomies ); ?>"
3939
>
40-
<?php if ( ! empty( $terms ) ) : foreach ( $terms as $term ) : ?>
40+
<?php if ( ! empty( $terms ) ) : ?>
41+
<?php foreach ( $terms as $term ) : ?>
4142
<option value="<?php echo esc_attr( $term->term_id ); ?>" selected="selected">
4243
<?php echo esc_html( $this->get_term_caption( $term ) ); ?>
4344
</option>
44-
<?php endforeach; endif; ?>
45+
<?php endforeach; ?>
46+
<?php endif; ?>
4547
</select>
4648
<?php
4749
}
@@ -115,7 +117,7 @@ public static function ajax_search_terms() {
115117
ORDER BY t.name ASC
116118
LIMIT 20
117119
", $params );
118-
$rows = $wpdb->get_results($query, OBJECT_K );
120+
$rows = $wpdb->get_results( $query, OBJECT_K );
119121

120122
$results = [];
121123
foreach ( $rows as $row ) {

framework/Page_Builder/v25/Layouts/Layout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ protected function generate_inline_styles( $style_data, $unique_selector = '' )
7171
$styles['bg_size'] = 'background-size:cover';
7272
break;
7373
}
74-
} // End if().
74+
}
7575

7676
$styles = implode( ';', $styles );
7777

7878
return $styles;
7979
}
8080

81-
}
81+
}

0 commit comments

Comments
 (0)