@@ -1,6 +1,6 @@ |
||
1 | 1 | <h2 class="nav-tab-wrapper"> |
2 | 2 | @foreach( $tabs as $tab => $name ) |
3 | - <?php $class = ( $tab == $current_tab ) ? ' nav-tab-active' : '';?> |
|
3 | + <?php $class = ($tab == $current_tab) ? ' nav-tab-active' : ''; ?> |
|
4 | 4 | <a class='nav-tab{{ $class }}' href='?page=wpdfi-settings.php&tab={{ $tab }}'>{{ $name }}</a> |
5 | 5 | @endforeach |
6 | 6 | </h2> |
7 | 7 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | -<form method="POST" action="<?php \admin_url( 'options-general.php?page=wpdfi-settings.php' ); ?>" id="wpdfi-form"> |
|
1 | +<form method="POST" action="<?php \admin_url('options-general.php?page=wpdfi-settings.php'); ?>" id="wpdfi-form"> |
|
2 | 2 | <div class="error-wrapper" id="error_wrapper"></div> |
3 | - <?php wp_nonce_field( "wpdfi-settings-page" ); ?> |
|
3 | + <?php wp_nonce_field("wpdfi-settings-page"); ?> |
|
4 | 4 | <div class="container"> |
5 | 5 | <div class="option-container"> |
6 | 6 | <div class="option-group" id="section_wrapper" class="list-group"> |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | |
48 | 48 | $data = []; |
49 | 49 | // Default size |
50 | - if ( in_array( $size_name, ['thumbnail', 'medium', 'medium_large', 'large'] ) ) { |
|
51 | - $data['width'] = get_option( "{$size_name}_size_w" ); |
|
52 | - $data['height'] = get_option( "{$size_name}_size_h" ); |
|
50 | + if (in_array($size_name, ['thumbnail', 'medium', 'medium_large', 'large'])) { |
|
51 | + $data['width'] = get_option("{$size_name}_size_w"); |
|
52 | + $data['height'] = get_option("{$size_name}_size_h"); |
|
53 | 53 | // Additional size |
54 | - } elseif ( isset( $_wp_additional_image_sizes[ $size_name ] ) ) { |
|
55 | - $data['width'] = $_wp_additional_image_sizes[ $size_name ]['width']; |
|
56 | - $data['height'] = $_wp_additional_image_sizes[ $size_name ]['height']; |
|
54 | + } elseif (isset($_wp_additional_image_sizes[$size_name])) { |
|
55 | + $data['width'] = $_wp_additional_image_sizes[$size_name]['width']; |
|
56 | + $data['height'] = $_wp_additional_image_sizes[$size_name]['height']; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $data; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function get_size_names_and_dimensions() { |
69 | 69 | $data = []; |
70 | 70 | |
71 | - foreach($this->get_size_names() as $size_name) { |
|
71 | + foreach ($this->get_size_names() as $size_name) { |
|
72 | 72 | $data[$size_name] = $this->get_size_dimensions($size_name); |
73 | 73 | } |
74 | 74 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __get($name) |
39 | 39 | { |
40 | - switch($name) { |
|
40 | + switch ($name) { |
|
41 | 41 | // Load sub-module first |
42 | 42 | case isset($this->modules[$name]): |
43 | 43 | return $this->modules[$name]; |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public function moduleHooks() { |
58 | - foreach($this->modules as $module) { |
|
59 | - if(method_exists($module, 'hooks')) { |
|
58 | + foreach ($this->modules as $module) { |
|
59 | + if (method_exists($module, 'hooks')) { |
|
60 | 60 | $module->hooks(); |
61 | 61 | } |
62 | 62 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return mixed $handle |
72 | 72 | */ |
73 | 73 | public function module($name, $handle = null) { |
74 | - if(!isset($this->modules[$name])) |
|
74 | + if (!isset($this->modules[$name])) |
|
75 | 75 | $this->modules[$name] = $handle; |
76 | 76 | return $this->modules[$name]; |
77 | 77 | } |
@@ -71,8 +71,9 @@ |
||
71 | 71 | * @return mixed $handle |
72 | 72 | */ |
73 | 73 | public function module($name, $handle = null) { |
74 | - if(!isset($this->modules[$name])) |
|
75 | - $this->modules[$name] = $handle; |
|
74 | + if(!isset($this->modules[$name])) { |
|
75 | + $this->modules[$name] = $handle; |
|
76 | + } |
|
76 | 77 | return $this->modules[$name]; |
77 | 78 | } |
78 | 79 | } |
79 | 80 | \ No newline at end of file |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * @return WPDFI\Traits\Singleton A single instance of this class. |
37 | 37 | */ |
38 | 38 | public static function instance() { |
39 | - if ( null === self::$instance ) { |
|
39 | + if (null === self::$instance) { |
|
40 | 40 | self::$instance = new self(); |
41 | 41 | } |
42 | 42 | return self::$instance; |
@@ -33,11 +33,11 @@ |
||
33 | 33 | public function get($post_type) { |
34 | 34 | $data = []; |
35 | 35 | |
36 | - if($post_type) { |
|
36 | + if ($post_type) { |
|
37 | 37 | |
38 | - foreach(\get_object_taxonomies($post_type, 'objects') as $index => $taxonomy) { |
|
38 | + foreach (\get_object_taxonomies($post_type, 'objects') as $index => $taxonomy) { |
|
39 | 39 | // Only accept taxonomies which visible to admin and reader |
40 | - if($taxonomy->show_ui and $taxonomy->show_in_menu) { |
|
40 | + if ($taxonomy->show_ui and $taxonomy->show_in_menu) { |
|
41 | 41 | |
42 | 42 | $data[$index]['name'] = $taxonomy->name; |
43 | 43 | $data[$index]['label'] = $taxonomy->label; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return VA\Templater |
35 | 35 | */ |
36 | 36 | public function get_admin_layout($tabs, $current_tab, $options, $layout_name) { |
37 | - return \wpdfi()->templater->render('admin.layout',[ |
|
37 | + return \wpdfi()->templater->render('admin.layout', [ |
|
38 | 38 | 'tabs' => $tabs, 'current_tab' => $current_tab, |
39 | 39 | 'options' => $options, 'layout_name' => $layout_name, |
40 | 40 | ]); |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | public function get_related_layout($section_index, $post_type) { |
77 | 77 | $layout = ''; |
78 | 78 | /* Get taxonomy layout */ |
79 | - $layout.= \wpdfi()->templater->render('admin.blocks.taxonomy.default', [ |
|
79 | + $layout .= \wpdfi()->templater->render('admin.blocks.taxonomy.default', [ |
|
80 | 80 | 'taxonomies' => \wpdfi()->taxonomy->get($post_type), |
81 | 81 | 'section_index' => $section_index |
82 | 82 | ]); |
83 | - $layout.= \wpdfi()->templater->render('admin.blocks.imageupload.default', [ |
|
83 | + $layout .= \wpdfi()->templater->render('admin.blocks.imageupload.default', [ |
|
84 | 84 | 'section_index' => $section_index |
85 | 85 | ]); |
86 | 86 | // $layout.= \wpdfi()->templater->render('admin.blocks.imagesize.default', [ |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | public function get($taxonomy) { |
34 | 34 | $names = []; |
35 | 35 | |
36 | - if($taxonomy) { |
|
36 | + if ($taxonomy) { |
|
37 | 37 | |
38 | 38 | $terms = \get_terms([ |
39 | 39 | 'taxonomy' => $taxonomy, |
40 | 40 | 'hide_empty' => false |
41 | 41 | ]); |
42 | 42 | |
43 | - foreach($terms as $index => $term) { |
|
43 | + foreach ($terms as $index => $term) { |
|
44 | 44 | |
45 | 45 | $names[$index]['id'] = $term->term_id; |
46 | 46 | $names[$index]['text'] = $term->name; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $terms_array = []; |
65 | 65 | |
66 | - foreach($terms as $term) { |
|
66 | + foreach ($terms as $term) { |
|
67 | 67 | |
68 | 68 | $terms_array[$term->taxonomy][] = $term->term_id; |
69 | 69 |
@@ -10,88 +10,88 @@ |
||
10 | 10 | |
11 | 11 | final class Notice |
12 | 12 | { |
13 | - use Singleton; |
|
13 | + use Singleton; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @traitDoc |
|
17 | - */ |
|
18 | - public function initializes() |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
15 | + /** |
|
16 | + * @traitDoc |
|
17 | + */ |
|
18 | + public function initializes() |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Type of notice, it can be 'success', 'error', 'warning', 'info'. |
|
25 | - */ |
|
26 | - private $type; |
|
23 | + /** |
|
24 | + * Type of notice, it can be 'success', 'error', 'warning', 'info'. |
|
25 | + */ |
|
26 | + private $type; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Message of the notice |
|
30 | - */ |
|
31 | - private $message; |
|
28 | + /** |
|
29 | + * Message of the notice |
|
30 | + */ |
|
31 | + private $message; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Add new notice to the admin dashboard. |
|
35 | - * |
|
36 | - * @param string $noticeMessage |
|
37 | - * @param string $noticeType |
|
38 | - * @since 1.0.0 |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - public function add($noticeMessage, $noticeType = 'info') |
|
42 | - { |
|
43 | - $this->message = $noticeMessage; |
|
44 | - $this->type = $noticeType; |
|
33 | + /** |
|
34 | + * Add new notice to the admin dashboard. |
|
35 | + * |
|
36 | + * @param string $noticeMessage |
|
37 | + * @param string $noticeType |
|
38 | + * @since 1.0.0 |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + public function add($noticeMessage, $noticeType = 'info') |
|
42 | + { |
|
43 | + $this->message = $noticeMessage; |
|
44 | + $this->type = $noticeType; |
|
45 | 45 | |
46 | - \add_action( 'admin_notices', [$this, 'display']); |
|
47 | - } |
|
46 | + \add_action( 'admin_notices', [$this, 'display']); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Display notice template to the admin dashboard. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @return VA\Templater |
|
54 | - */ |
|
55 | - public function display() |
|
56 | - { |
|
57 | - if(!$this->message) return; |
|
49 | + /** |
|
50 | + * Display notice template to the admin dashboard. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @return VA\Templater |
|
54 | + */ |
|
55 | + public function display() |
|
56 | + { |
|
57 | + if(!$this->message) return; |
|
58 | 58 | |
59 | - echo \wpdfi()->templater->render('admin/notice', [ |
|
60 | - 'classes' => $this->get_classes(), |
|
61 | - 'message' => __($this->message, 'wpdfi') |
|
62 | - ]); |
|
63 | - } |
|
59 | + echo \wpdfi()->templater->render('admin/notice', [ |
|
60 | + 'classes' => $this->get_classes(), |
|
61 | + 'message' => __($this->message, 'wpdfi') |
|
62 | + ]); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Get all the classes of the notice |
|
67 | - * |
|
68 | - * @since 1.0.0 |
|
69 | - * @return string |
|
70 | - */ |
|
71 | - private function get_classes() |
|
72 | - { |
|
73 | - return "notice notice-{$this->get_type()} is-dismissible"; |
|
74 | - } |
|
65 | + /** |
|
66 | + * Get all the classes of the notice |
|
67 | + * |
|
68 | + * @since 1.0.0 |
|
69 | + * @return string |
|
70 | + */ |
|
71 | + private function get_classes() |
|
72 | + { |
|
73 | + return "notice notice-{$this->get_type()} is-dismissible"; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Get the type of the notice |
|
78 | - * |
|
79 | - * @since 1.0.0 |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - private function get_type() |
|
83 | - { |
|
84 | - return $this->type ? $this->type : $this->get_default_type(); |
|
85 | - } |
|
76 | + /** |
|
77 | + * Get the type of the notice |
|
78 | + * |
|
79 | + * @since 1.0.0 |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + private function get_type() |
|
83 | + { |
|
84 | + return $this->type ? $this->type : $this->get_default_type(); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Get default type of the notice |
|
89 | - * |
|
90 | - * @since 1.0.0 |
|
91 | - * @return string |
|
92 | - */ |
|
93 | - private function get_default_type() |
|
94 | - { |
|
95 | - return 'info'; |
|
96 | - } |
|
87 | + /** |
|
88 | + * Get default type of the notice |
|
89 | + * |
|
90 | + * @since 1.0.0 |
|
91 | + * @return string |
|
92 | + */ |
|
93 | + private function get_default_type() |
|
94 | + { |
|
95 | + return 'info'; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->message = $noticeMessage; |
44 | 44 | $this->type = $noticeType; |
45 | 45 | |
46 | - \add_action( 'admin_notices', [$this, 'display']); |
|
46 | + \add_action('admin_notices', [$this, 'display']); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function display() |
56 | 56 | { |
57 | - if(!$this->message) return; |
|
57 | + if (!$this->message) return; |
|
58 | 58 | |
59 | 59 | echo \wpdfi()->templater->render('admin/notice', [ |
60 | 60 | 'classes' => $this->get_classes(), |
@@ -54,7 +54,9 @@ |
||
54 | 54 | */ |
55 | 55 | public function display() |
56 | 56 | { |
57 | - if(!$this->message) return; |
|
57 | + if(!$this->message) { |
|
58 | + return; |
|
59 | + } |
|
58 | 60 | |
59 | 61 | echo \wpdfi()->templater->render('admin/notice', [ |
60 | 62 | 'classes' => $this->get_classes(), |