@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | // protected $public; |
23 | 23 | // protected $translator; |
24 | 24 | |
25 | - public function __construct( Application $app ) { |
|
25 | + public function __construct(Application $app) { |
|
26 | 26 | $this->app = $app; |
27 | - $this->admin = $app->make( AdminController::class ); |
|
28 | - $this->basename = plugin_basename( $app->file ); |
|
27 | + $this->admin = $app->make(AdminController::class); |
|
28 | + $this->basename = plugin_basename($app->file); |
|
29 | 29 | // $this->editor = $app->make( EditorController::class ); |
30 | - $this->listtable = $app->make( ListTableController::class ); |
|
31 | - $this->main = $app->make( MainController::class ); |
|
30 | + $this->listtable = $app->make(ListTableController::class); |
|
31 | + $this->main = $app->make(MainController::class); |
|
32 | 32 | // $this->public = $app->make( PublicController::class ); |
33 | 33 | // $this->translator = $app->make( Translator::class ); |
34 | 34 | } |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function run() |
40 | 40 | { |
41 | - add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | - add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | - add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
41 | + add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
42 | + add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
43 | + add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
44 | 44 | // add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
45 | 45 | // add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
46 | 46 | // add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
47 | 47 | // add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
48 | 48 | // add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
49 | - add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | - add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | - add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
52 | - add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
53 | - add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
|
54 | - add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
49 | + add_filter('bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2); |
|
50 | + add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
51 | + add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
52 | + add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
53 | + add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
54 | + add_filter('ngettext', [$this->listtable, 'filterStatusText'], 10, 5); |
|
55 | 55 | // add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
56 | 56 | // add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
57 | 57 | // add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
@@ -14,8 +14,8 @@ |
||
14 | 14 | { |
15 | 15 | return [ |
16 | 16 | 'columns' => [ |
17 | - 'title' => __( 'Title', 'site-reviews' ), |
|
18 | - 'date' => __( 'Date', 'site-reviews' ), |
|
17 | + 'title' => __('Title', 'site-reviews'), |
|
18 | + 'date' => __('Date', 'site-reviews'), |
|
19 | 19 | ], |
20 | 20 | 'has_archive' => false, |
21 | 21 | 'hierarchical' => false, |
@@ -12,10 +12,10 @@ |
||
12 | 12 | /** |
13 | 13 | * @return array |
14 | 14 | */ |
15 | - public function merge( array $values = [], $restrict = false ) |
|
15 | + public function merge(array $values = [], $restrict = false) |
|
16 | 16 | { |
17 | 17 | return $restrict |
18 | - ? shortcode_atts( $this->defaults(), $values ) |
|
19 | - : wp_parse_args( $values, $this->defaults() ); |
|
18 | + ? shortcode_atts($this->defaults(), $values) |
|
19 | + : wp_parse_args($values, $this->defaults()); |
|
20 | 20 | } |
21 | 21 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | 'author' => '', |
17 | 17 | 'avatar' => '', |
18 | 18 | 'content' => '', |
19 | - 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )), |
|
19 | + 'date' => get_date_from_gmt(gmdate('Y-m-d H:i:s')), |
|
20 | 20 | 'email' => '', |
21 | 21 | 'ip_address' => '', |
22 | 22 | 'pinned' => false, |
23 | 23 | 'rating' => '', |
24 | 24 | 'response' => '', |
25 | - 'review_id' => md5( time().mt_rand() ), |
|
25 | + 'review_id' => md5(time().mt_rand()), |
|
26 | 26 | 'review_type' => 'local', |
27 | 27 | 'title' => '', |
28 | 28 | 'url' => '', |
@@ -20,17 +20,17 @@ |
||
20 | 20 | /** |
21 | 21 | * @return void |
22 | 22 | */ |
23 | - public function register( Application $app ) |
|
23 | + public function register(Application $app) |
|
24 | 24 | { |
25 | - $app->bind( Application::class, $app ); |
|
25 | + $app->bind(Application::class, $app); |
|
26 | 26 | // $app->singleton( Session::class, Session::class ); |
27 | - $app->singleton( Translator::class, Translator::class ); |
|
28 | - $app->singleton( AdminController::class, AdminController::class ); |
|
29 | - $app->singleton( AjaxController::class, AjaxController::class ); |
|
27 | + $app->singleton(Translator::class, Translator::class); |
|
28 | + $app->singleton(AdminController::class, AdminController::class); |
|
29 | + $app->singleton(AjaxController::class, AjaxController::class); |
|
30 | 30 | // $app->singleton( EditorController::class, EditorController::class ); |
31 | - $app->singleton( ListTableController::class, ListTableController::class ); |
|
32 | - $app->singleton( MainController::class, MainController::class ); |
|
33 | - $app->singleton( MenuController::class, MenuController::class ); |
|
31 | + $app->singleton(ListTableController::class, ListTableController::class); |
|
32 | + $app->singleton(MainController::class, MainController::class); |
|
33 | + $app->singleton(MenuController::class, MenuController::class); |
|
34 | 34 | // $app->singleton( PublicController::class, PublicController::class ); |
35 | 35 | // $app->singleton( SettingsController::class, SettingsController::class ); |
36 | 36 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public $shortcodes; |
8 | 8 | |
9 | - public function __construct( $input ) |
|
9 | + public function __construct($input) |
|
10 | 10 | { |
11 | 11 | $this->shortcodes = $input; |
12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public $shortcodes; |
8 | 8 | |
9 | - public function __construct( $input ) |
|
9 | + public function __construct($input) |
|
10 | 10 | { |
11 | 11 | $this->shortcodes = $input; |
12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public $widgets; |
8 | 8 | |
9 | - public function __construct( $input ) |
|
9 | + public function __construct($input) |
|
10 | 10 | { |
11 | 11 | $this->widgets = (object)$input; |
12 | 12 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | public $postType; |
15 | 15 | public $single; |
16 | 16 | |
17 | - public function __construct( $input ) |
|
17 | + public function __construct($input) |
|
18 | 18 | { |
19 | - $args = glsr( PostTypeDefaults::class )->merge( $input ); |
|
20 | - $this->normalize( $args ); |
|
19 | + $args = glsr(PostTypeDefaults::class)->merge($input); |
|
20 | + $this->normalize($args); |
|
21 | 21 | $this->normalizeColumns(); |
22 | 22 | $this->normalizeLabels(); |
23 | 23 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - protected function normalize( array $args ) |
|
28 | + protected function normalize(array $args) |
|
29 | 29 | { |
30 | - foreach( $args as $key => $value ) { |
|
31 | - $property = glsr( Helper::class )->buildPropertyName( $key ); |
|
32 | - if( !property_exists( $this, $property ))continue; |
|
30 | + foreach ($args as $key => $value) { |
|
31 | + $property = glsr(Helper::class)->buildPropertyName($key); |
|
32 | + if (!property_exists($this, $property))continue; |
|
33 | 33 | $this->$property = $value; |
34 | - unset( $args[$key] ); |
|
34 | + unset($args[$key]); |
|
35 | 35 | } |
36 | - $this->args = wp_parse_args( $args, [ |
|
36 | + $this->args = wp_parse_args($args, [ |
|
37 | 37 | 'menu_name' => $this->plural, |
38 | 38 | ]); |
39 | 39 | } |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function normalizeLabels() |
45 | 45 | { |
46 | - $this->args['labels'] = wp_parse_args( $this->args['labels'], [ |
|
47 | - 'add_new_item' => sprintf( _x( 'Add New %s', 'Add New Post', 'site-reviews' ), $this->plural ), |
|
48 | - 'all_items' => sprintf( _x( 'All %s', 'All Posts', 'site-reviews' ), $this->plural ), |
|
49 | - 'archives' => sprintf( _x( '%s Archives', 'Post Archives', 'site-reviews' ), $this->single ), |
|
50 | - 'edit_item' => sprintf( _x( 'Edit %s', 'Edit Post', 'site-reviews' ), $this->single ), |
|
51 | - 'insert_into_item' => sprintf( _x( 'Insert into %s', 'Insert into Post', 'site-reviews' ), $this->single ), |
|
46 | + $this->args['labels'] = wp_parse_args($this->args['labels'], [ |
|
47 | + 'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural), |
|
48 | + 'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural), |
|
49 | + 'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single), |
|
50 | + 'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single), |
|
51 | + 'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single), |
|
52 | 52 | 'menu_name' => $this->args['menu_name'], |
53 | 53 | 'name' => $this->plural, |
54 | - 'new_item' => sprintf( _x( 'New %s', 'New Post', 'site-reviews' ), $this->single ), |
|
55 | - 'not_found' => sprintf( _x( 'No %s found', 'No Posts found', 'site-reviews' ), $this->plural ), |
|
56 | - 'not_found_in_trash' => sprintf( _x( 'No %s found in Trash', 'No Posts found in Trash', 'site-reviews' ), $this->plural ), |
|
57 | - 'search_items' => sprintf( _x( 'Search %s', 'Search Posts', 'site-reviews' ), $this->plural ), |
|
54 | + 'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single), |
|
55 | + 'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural), |
|
56 | + 'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural), |
|
57 | + 'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural), |
|
58 | 58 | 'singular_name' => $this->single, |
59 | - 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
|
60 | - 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
|
59 | + 'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single), |
|
60 | + 'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single), |
|
61 | 61 | ]); |
62 | - unset( $this->args['menu_name'] ); |
|
62 | + unset($this->args['menu_name']); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | protected function normalizeColumns() |
69 | 69 | { |
70 | 70 | $this->columns = ['cb' => ''] + $this->columns; |
71 | - if( array_key_exists( 'category', $this->columns )) { |
|
72 | - $keys = array_keys( $this->columns ); |
|
73 | - $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
|
74 | - $this->columns = array_combine( $keys, $this->columns ); |
|
71 | + if (array_key_exists('category', $this->columns)) { |
|
72 | + $keys = array_keys($this->columns); |
|
73 | + $keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY; |
|
74 | + $this->columns = array_combine($keys, $this->columns); |
|
75 | 75 | } |
76 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
76 | + if (array_key_exists('pinned', $this->columns)) { |
|
77 | 77 | $stickyValue = '<span class="pinned-icon"><span>'.$this->columns['pinned'].'</span></span>'; |
78 | 78 | $this->columns['pinned'] = $stickyValue; |
79 | 79 | } |