@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | use SimpleCalendar\Abstracts\Admin_Page; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param string $page |
55 | 55 | */ |
56 | - public function __construct( $page = 'settings' ) { |
|
56 | + public function __construct($page = 'settings') { |
|
57 | 57 | |
58 | 58 | $this->page = $page; |
59 | - $settings_pages = ! is_null( \SimpleCalendar\plugin()->objects ) ? simcal_get_admin_pages() : ''; |
|
59 | + $settings_pages = ! is_null(\SimpleCalendar\plugin()->objects) ? simcal_get_admin_pages() : ''; |
|
60 | 60 | $settings_page_tabs = array(); |
61 | - $tabs = isset( $settings_pages[ $page ] ) ? $settings_pages[ $page ] : false; |
|
61 | + $tabs = isset($settings_pages[$page]) ? $settings_pages[$page] : false; |
|
62 | 62 | |
63 | - if ( $tabs && is_array( $tabs ) ) { |
|
64 | - foreach ( $tabs as $tab ) { |
|
63 | + if ($tabs && is_array($tabs)) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | |
66 | - $settings_page = simcal_get_admin_page( $tab ); |
|
66 | + $settings_page = simcal_get_admin_page($tab); |
|
67 | 67 | |
68 | - if ( $settings_page instanceof Admin_Page ) { |
|
69 | - $settings_page_tabs[ $settings_page->id ] = $settings_page; |
|
68 | + if ($settings_page instanceof Admin_Page) { |
|
69 | + $settings_page_tabs[$settings_page->id] = $settings_page; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | // The first tab is the default tab when opening a page. |
77 | - $this->tab = isset( $tabs[0] ) ? $tabs[0] : ''; |
|
77 | + $this->tab = isset($tabs[0]) ? $tabs[0] : ''; |
|
78 | 78 | |
79 | - do_action( 'simcal_admin_pages', $page ); |
|
79 | + do_action('simcal_admin_pages', $page); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | |
92 | 92 | $settings = array(); |
93 | 93 | |
94 | - if ( ! empty( $this->settings ) && is_array( $this->settings ) ) { |
|
95 | - foreach ( $this->settings as $id => $object ) { |
|
94 | + if ( ! empty($this->settings) && is_array($this->settings)) { |
|
95 | + foreach ($this->settings as $id => $object) { |
|
96 | 96 | |
97 | - if ( $object instanceof Admin_Page ) { |
|
97 | + if ($object instanceof Admin_Page) { |
|
98 | 98 | |
99 | 99 | $settings_page = $object->get_settings(); |
100 | 100 | |
101 | - if ( isset( $settings_page[ $id ] ) ) { |
|
102 | - $settings[ $id ] = $settings_page[ $id ]; |
|
101 | + if (isset($settings_page[$id])) { |
|
102 | + $settings[$id] = $settings_page[$id]; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -118,48 +118,48 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param array $settings |
120 | 120 | */ |
121 | - public function register_settings( $settings = array() ) { |
|
121 | + public function register_settings($settings = array()) { |
|
122 | 122 | |
123 | 123 | $settings = $settings ? $settings : $this->get_settings(); |
124 | 124 | |
125 | - if ( ! empty( $settings ) && is_array( $settings ) ) { |
|
125 | + if ( ! empty($settings) && is_array($settings)) { |
|
126 | 126 | |
127 | - foreach ( $settings as $tab_id => $settings_page ) { |
|
127 | + foreach ($settings as $tab_id => $settings_page) { |
|
128 | 128 | |
129 | - if ( isset( $settings_page['sections'] ) ) { |
|
129 | + if (isset($settings_page['sections'])) { |
|
130 | 130 | |
131 | 131 | $sections = $settings_page['sections']; |
132 | 132 | |
133 | - if ( ! empty( $sections ) && is_array( $sections ) ) { |
|
133 | + if ( ! empty($sections) && is_array($sections)) { |
|
134 | 134 | |
135 | - foreach ( $sections as $section_id => $section ) { |
|
135 | + foreach ($sections as $section_id => $section) { |
|
136 | 136 | |
137 | 137 | add_settings_section( |
138 | 138 | $section_id, |
139 | - isset( $section['title'] ) ? $section['title'] : '', |
|
140 | - isset( $section['callback'] ) ? $section['callback'] : '', |
|
141 | - 'simple-calendar_' . $this->page . '_' . $tab_id |
|
139 | + isset($section['title']) ? $section['title'] : '', |
|
140 | + isset($section['callback']) ? $section['callback'] : '', |
|
141 | + 'simple-calendar_'.$this->page.'_'.$tab_id |
|
142 | 142 | ); |
143 | 143 | |
144 | - if ( isset( $section['fields'] ) ) { |
|
144 | + if (isset($section['fields'])) { |
|
145 | 145 | |
146 | 146 | $fields = $section['fields']; |
147 | 147 | |
148 | - if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
148 | + if ( ! empty($fields) && is_array($fields)) { |
|
149 | 149 | |
150 | - foreach ( $fields as $field ) { |
|
150 | + foreach ($fields as $field) { |
|
151 | 151 | |
152 | - if ( isset( $field['id'] ) && isset( $field['type'] ) ) { |
|
152 | + if (isset($field['id']) && isset($field['type'])) { |
|
153 | 153 | |
154 | - $field_object = simcal_get_field( $field, $field['type'] ); |
|
154 | + $field_object = simcal_get_field($field, $field['type']); |
|
155 | 155 | |
156 | - if ( $field_object instanceof Field ) { |
|
156 | + if ($field_object instanceof Field) { |
|
157 | 157 | |
158 | 158 | add_settings_field( |
159 | 159 | $field['id'], |
160 | - isset( $field['title'] ) ? $field['title'] : '', |
|
161 | - array( $field_object, 'html' ), |
|
162 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
160 | + isset($field['title']) ? $field['title'] : '', |
|
161 | + array($field_object, 'html'), |
|
162 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
163 | 163 | $section_id |
164 | 164 | ); |
165 | 165 | |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | } // are there fields? |
175 | 175 | |
176 | - $page = simcal_get_admin_page( $tab_id ); |
|
176 | + $page = simcal_get_admin_page($tab_id); |
|
177 | 177 | |
178 | 178 | register_setting( |
179 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
180 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
181 | - $page instanceof Admin_Page ? array( $page, 'validate' ) : '' |
|
179 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
180 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
181 | + $page instanceof Admin_Page ? array($page, 'validate') : '' |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | } // loop sections |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | global $current_tab; |
204 | 204 | |
205 | 205 | // Get current tab/section |
206 | - $current_tab = empty( $_GET['tab'] ) ? $this->tab : sanitize_title( $_GET['tab'] ); |
|
206 | + $current_tab = empty($_GET['tab']) ? $this->tab : sanitize_title($_GET['tab']); |
|
207 | 207 | $this->tab = $current_tab; |
208 | 208 | |
209 | 209 | ?> |
@@ -215,45 +215,45 @@ discard block |
||
215 | 215 | |
216 | 216 | // Include settings pages |
217 | 217 | $settings_pages = self::get_settings(); |
218 | - if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) { |
|
218 | + if ( ! empty($settings_pages) && is_array($settings_pages)) { |
|
219 | 219 | |
220 | 220 | echo '<h2 class="nav-tab-wrapper simcal-nav-tab-wrapper">'; |
221 | 221 | |
222 | 222 | // Get tabs for the settings page |
223 | - if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) { |
|
223 | + if ( ! empty($settings_pages) && is_array($settings_pages)) { |
|
224 | 224 | |
225 | - foreach ( $settings_pages as $id => $settings ) { |
|
225 | + foreach ($settings_pages as $id => $settings) { |
|
226 | 226 | |
227 | - $tab_id = isset( $id ) ? $id : ''; |
|
228 | - $tab_label = isset( $settings['label'] ) ? $settings['label'] : ''; |
|
229 | - $tab_link = admin_url( 'edit.php?post_type=calendar&page=simple-calendar_' . $this->page . '&tab=' . $tab_id ); |
|
227 | + $tab_id = isset($id) ? $id : ''; |
|
228 | + $tab_label = isset($settings['label']) ? $settings['label'] : ''; |
|
229 | + $tab_link = admin_url('edit.php?post_type=calendar&page=simple-calendar_'.$this->page.'&tab='.$tab_id); |
|
230 | 230 | |
231 | - echo '<a href="' . $tab_link . '" class="nav-tab ' . ( $current_tab == $tab_id ? 'nav-tab-active' : '' ) . '">' . $tab_label . '</a>'; |
|
231 | + echo '<a href="'.$tab_link.'" class="nav-tab '.($current_tab == $tab_id ? 'nav-tab-active' : '').'">'.$tab_label.'</a>'; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | } |
235 | 235 | |
236 | - do_action( 'simcal_admin_page_' . $this->page . '_tabs' ); |
|
236 | + do_action('simcal_admin_page_'.$this->page.'_tabs'); |
|
237 | 237 | |
238 | 238 | echo '</h2>'; |
239 | 239 | |
240 | 240 | settings_errors(); |
241 | 241 | |
242 | - foreach ( $settings_pages as $tab_id => $contents ) { |
|
242 | + foreach ($settings_pages as $tab_id => $contents) { |
|
243 | 243 | |
244 | - if ( $tab_id === $current_tab ) { |
|
244 | + if ($tab_id === $current_tab) { |
|
245 | 245 | |
246 | - echo isset( $contents['description'] ) ? '<p>' . $contents['description'] . '</p>' : ''; |
|
246 | + echo isset($contents['description']) ? '<p>'.$contents['description'].'</p>' : ''; |
|
247 | 247 | |
248 | - do_action( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_start' ); |
|
248 | + do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_start'); |
|
249 | 249 | |
250 | - settings_fields( 'simple-calendar_' . $this->page . '_' . $tab_id ); |
|
251 | - do_settings_sections( 'simple-calendar_' . $this->page . '_' . $tab_id ); |
|
250 | + settings_fields('simple-calendar_'.$this->page.'_'.$tab_id); |
|
251 | + do_settings_sections('simple-calendar_'.$this->page.'_'.$tab_id); |
|
252 | 252 | |
253 | - do_action( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_end' ); |
|
253 | + do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_end'); |
|
254 | 254 | |
255 | - $submit = apply_filters( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_submit', true ); |
|
256 | - if ( true === $submit ) { |
|
255 | + $submit = apply_filters('simcal_admin_page_'.$this->page.'_'.$current_tab.'_submit', true); |
|
256 | + if (true === $submit) { |
|
257 | 257 | submit_button(); |
258 | 258 | } |
259 | 259 | } |
@@ -6,9 +6,6 @@ |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Updates; |
8 | 8 | |
9 | -use Carbon\Carbon; |
|
10 | -use SimpleCalendar\Post_Types; |
|
11 | - |
|
12 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
13 | 10 | exit; |
14 | 11 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use Carbon\Carbon; |
10 | 10 | use SimpleCalendar\Post_Types; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param array $posts |
25 | 25 | */ |
26 | - public function __construct( $posts ) { |
|
26 | + public function __construct($posts) { |
|
27 | 27 | |
28 | 28 | $this->update_options(); |
29 | 29 | } |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function update_options() { |
36 | 36 | |
37 | - $settings_advanced = get_option( 'simple-calendar_settings_advanced' ); |
|
37 | + $settings_advanced = get_option('simple-calendar_settings_advanced'); |
|
38 | 38 | |
39 | 39 | // Remove stored always_enqueue value |
40 | - if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) { |
|
41 | - unset( $settings_advanced['assets']['always_enqueue'] ); |
|
40 | + if (isset($settings_advanced['assets']['always_enqueue'])) { |
|
41 | + unset($settings_advanced['assets']['always_enqueue']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Remove stored disable_js value |
45 | - if ( isset( $settings_advanced['assets']['disable_js'] ) ) { |
|
46 | - unset( $settings_advanced['assets']['disable_js'] ); |
|
45 | + if (isset($settings_advanced['assets']['disable_js'])) { |
|
46 | + unset($settings_advanced['assets']['disable_js']); |
|
47 | 47 | } |
48 | 48 | |
49 | - update_option( 'simple-calendar_settings_advanced', $settings_advanced ); |
|
49 | + update_option('simple-calendar_settings_advanced', $settings_advanced); |
|
50 | 50 | |
51 | 51 | // Delete legacy options. |
52 | - delete_option( 'simple-calendar_defaults' ); |
|
52 | + delete_option('simple-calendar_defaults'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Calendar_View; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function __construct() { |
62 | 62 | |
63 | - $this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min'; |
|
63 | + $this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min'; |
|
64 | 64 | |
65 | - $settings = get_option( 'simple-calendar_settings_advanced' ); |
|
65 | + $settings = get_option('simple-calendar_settings_advanced'); |
|
66 | 66 | |
67 | - if ( isset( $settings['assets']['disable_css'] ) ) { |
|
67 | + if (isset($settings['assets']['disable_css'])) { |
|
68 | 68 | $this->disable_styles = 'yes' == $settings['assets']['disable_css'] ? true : false; |
69 | 69 | } |
70 | 70 | |
71 | - add_action( 'init', array( $this, 'register' ), 20 ); |
|
72 | - add_action( 'init', array( $this, 'enqueue' ), 40 ); |
|
71 | + add_action('init', array($this, 'register'), 20); |
|
72 | + add_action('init', array($this, 'enqueue'), 40); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @since 3.0.0 |
79 | 79 | */ |
80 | 80 | public function register() { |
81 | - do_action( 'simcal_register_assets', $this->min ); |
|
81 | + do_action('simcal_register_assets', $this->min); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function enqueue() { |
90 | 90 | |
91 | - add_action( 'wp_enqueue_scripts', array( $this, 'load' ), 10 ); |
|
91 | + add_action('wp_enqueue_scripts', array($this, 'load'), 10); |
|
92 | 92 | |
93 | - do_action( 'simcal_enqueue_assets', $this->min ); |
|
93 | + do_action('simcal_enqueue_assets', $this->min); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | $min = $this->min; |
97 | 97 | // Improves compatibility with themes and plugins using Isotope and Masonry. |
98 | - add_action( 'wp_enqueue_scripts', |
|
99 | - function () use ( $min ) { |
|
100 | - if ( wp_script_is( 'simcal-qtip', 'enqueued' ) ) { |
|
98 | + add_action('wp_enqueue_scripts', |
|
99 | + function() use ($min) { |
|
100 | + if (wp_script_is('simcal-qtip', 'enqueued')) { |
|
101 | 101 | wp_enqueue_script( |
102 | 102 | 'simplecalendar-imagesloaded', |
103 | - SIMPLE_CALENDAR_ASSETS . 'js/vendor/imagesloaded.pkgd' . $min . '.js', |
|
104 | - array( 'simcal-qtip' ), |
|
103 | + SIMPLE_CALENDAR_ASSETS.'js/vendor/imagesloaded.pkgd'.$min.'.js', |
|
104 | + array('simcal-qtip'), |
|
105 | 105 | '3.1.8', |
106 | 106 | true |
107 | 107 | ); |
108 | 108 | } |
109 | - }, 1000 ); |
|
109 | + }, 1000); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | $scripts = $this->get_default_scripts(); |
120 | 120 | $styles = $this->get_default_styles(); |
121 | 121 | |
122 | - $this->scripts = apply_filters( 'simcal_front_end_scripts', $scripts, $this->min ); |
|
123 | - $this->styles = apply_filters( 'simcal_front_end_styles', $styles, $this->min ); |
|
122 | + $this->scripts = apply_filters('simcal_front_end_scripts', $scripts, $this->min); |
|
123 | + $this->styles = apply_filters('simcal_front_end_styles', $styles, $this->min); |
|
124 | 124 | |
125 | - $this->load_scripts( $this->scripts ); |
|
126 | - $this->load_styles( $this->styles ); |
|
125 | + $this->load_scripts($this->scripts); |
|
126 | + $this->load_styles($this->styles); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,25 +133,25 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function get_widgets_assets() { |
135 | 135 | |
136 | - $widgets = get_option( 'widget_gce_widget' ); |
|
136 | + $widgets = get_option('widget_gce_widget'); |
|
137 | 137 | |
138 | - if ( ! empty( $widgets ) && is_array( $widgets ) ) { |
|
138 | + if ( ! empty($widgets) && is_array($widgets)) { |
|
139 | 139 | |
140 | - foreach ( $widgets as $settings ) { |
|
140 | + foreach ($widgets as $settings) { |
|
141 | 141 | |
142 | - if ( ! empty( $settings ) && is_array( $settings ) ) { |
|
142 | + if ( ! empty($settings) && is_array($settings)) { |
|
143 | 143 | |
144 | - if ( isset( $settings['calendar_id'] ) ) { |
|
144 | + if (isset($settings['calendar_id'])) { |
|
145 | 145 | |
146 | - $view = simcal_get_calendar_view( absint( $settings['calendar_id'] ) ); |
|
146 | + $view = simcal_get_calendar_view(absint($settings['calendar_id'])); |
|
147 | 147 | |
148 | - if ( $view instanceof Calendar_View ) { |
|
149 | - add_filter( 'simcal_front_end_scripts', function ( $scripts, $min ) use ( $view ) { |
|
150 | - return array_merge( $scripts, $view->scripts( $min ) ); |
|
151 | - }, 100, 2 ); |
|
152 | - add_filter( 'simcal_front_end_styles', function ( $styles, $min ) use ( $view ) { |
|
153 | - return array_merge( $styles, $view->styles( $min ) ); |
|
154 | - }, 100, 2 ); |
|
148 | + if ($view instanceof Calendar_View) { |
|
149 | + add_filter('simcal_front_end_scripts', function($scripts, $min) use ($view) { |
|
150 | + return array_merge($scripts, $view->scripts($min)); |
|
151 | + }, 100, 2); |
|
152 | + add_filter('simcal_front_end_styles', function($styles, $min) use ($view) { |
|
153 | + return array_merge($styles, $view->styles($min)); |
|
154 | + }, 100, 2); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | } |
@@ -169,31 +169,31 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param array $scripts |
171 | 171 | */ |
172 | - public function load_scripts( $scripts ) { |
|
172 | + public function load_scripts($scripts) { |
|
173 | 173 | |
174 | 174 | // Only load if not disabled in the settings |
175 | - if ( ! empty( $scripts ) && is_array( $scripts ) ) { |
|
175 | + if ( ! empty($scripts) && is_array($scripts)) { |
|
176 | 176 | |
177 | - foreach ( $scripts as $script => $v ) { |
|
177 | + foreach ($scripts as $script => $v) { |
|
178 | 178 | |
179 | - if ( ! empty( $v['src'] ) ) { |
|
179 | + if ( ! empty($v['src'])) { |
|
180 | 180 | |
181 | - $src = esc_url( $v['src'] ); |
|
182 | - $deps = isset( $v['deps'] ) ? $v['deps'] : array(); |
|
183 | - $ver = isset( $v['ver'] ) ? $v['ver'] : SIMPLE_CALENDAR_VERSION; |
|
184 | - $in_footer = isset( $v['in_footer'] ) ? $v['in_footer'] : false; |
|
181 | + $src = esc_url($v['src']); |
|
182 | + $deps = isset($v['deps']) ? $v['deps'] : array(); |
|
183 | + $ver = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION; |
|
184 | + $in_footer = isset($v['in_footer']) ? $v['in_footer'] : false; |
|
185 | 185 | |
186 | - wp_enqueue_script( $script, $src, $deps, $ver, $in_footer ); |
|
186 | + wp_enqueue_script($script, $src, $deps, $ver, $in_footer); |
|
187 | 187 | |
188 | - if ( ! empty( $v['localize'] ) && is_array( $v['localize'] ) ) { |
|
189 | - foreach ( $v['localize'] as $object => $l10n ) { |
|
190 | - wp_localize_script( $script, $object, $l10n ); |
|
188 | + if ( ! empty($v['localize']) && is_array($v['localize'])) { |
|
189 | + foreach ($v['localize'] as $object => $l10n) { |
|
190 | + wp_localize_script($script, $object, $l10n); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | - } elseif ( is_string( $v ) && ! empty( $v ) ) { |
|
194 | + } elseif (is_string($v) && ! empty($v)) { |
|
195 | 195 | |
196 | - wp_enqueue_script( $v ); |
|
196 | + wp_enqueue_script($v); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -207,25 +207,25 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param array $styles |
209 | 209 | */ |
210 | - public function load_styles( $styles ) { |
|
210 | + public function load_styles($styles) { |
|
211 | 211 | |
212 | 212 | // Only load if not disabled in the settings |
213 | - if ( ! empty( $styles ) && is_array( $styles ) && false === $this->disable_styles ) { |
|
213 | + if ( ! empty($styles) && is_array($styles) && false === $this->disable_styles) { |
|
214 | 214 | |
215 | - foreach ( $styles as $style => $v ) { |
|
215 | + foreach ($styles as $style => $v) { |
|
216 | 216 | |
217 | - if ( ! empty( $v['src'] ) ) { |
|
217 | + if ( ! empty($v['src'])) { |
|
218 | 218 | |
219 | - $src = esc_url( $v['src'] ); |
|
220 | - $deps = isset( $v['deps'] ) ? $v['deps'] : array(); |
|
221 | - $ver = isset( $v['ver'] ) ? $v['ver'] : SIMPLE_CALENDAR_VERSION; |
|
222 | - $media = isset( $v['media'] ) ? $v['media'] : 'all'; |
|
219 | + $src = esc_url($v['src']); |
|
220 | + $deps = isset($v['deps']) ? $v['deps'] : array(); |
|
221 | + $ver = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION; |
|
222 | + $media = isset($v['media']) ? $v['media'] : 'all'; |
|
223 | 223 | |
224 | - wp_enqueue_style( $style, $src, $deps, $ver, $media ); |
|
224 | + wp_enqueue_style($style, $src, $deps, $ver, $media); |
|
225 | 225 | |
226 | - } elseif ( is_string( $v ) && ! empty( $v ) ) { |
|
226 | + } elseif (is_string($v) && ! empty($v)) { |
|
227 | 227 | |
228 | - wp_enqueue_style( $v ); |
|
228 | + wp_enqueue_style($v); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | } |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | public function get_default_scripts() { |
242 | 242 | return array( |
243 | 243 | 'simcal-qtip' => array( |
244 | - 'src' => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $this->min . '.js', |
|
245 | - 'deps' => array( 'jquery' ), |
|
244 | + 'src' => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$this->min.'.js', |
|
245 | + 'deps' => array('jquery'), |
|
246 | 246 | 'ver' => '2.2.1', |
247 | 247 | 'in_footer' => true, |
248 | 248 | ), |
249 | 249 | 'simcal-default-calendar' => array( |
250 | - 'src' => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $this->min . '.js', |
|
250 | + 'src' => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$this->min.'.js', |
|
251 | 251 | 'deps' => array( |
252 | 252 | 'jquery', |
253 | 253 | 'simcal-qtip', |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | public function get_default_styles() { |
270 | 270 | return array( |
271 | 271 | 'simcal-qtip' => array( |
272 | - 'src' => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $this->min . '.css', |
|
272 | + 'src' => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$this->min.'.css', |
|
273 | 273 | 'ver' => '2.2.1', |
274 | 274 | 'media' => 'all', |
275 | 275 | ), |
276 | 276 | 'simcal-default-calendar-grid' => array( |
277 | - 'src' => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $this->min . '.css', |
|
277 | + 'src' => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$this->min.'.css', |
|
278 | 278 | 'deps' => array( |
279 | 279 | 'simcal-qtip', |
280 | 280 | ), |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | 'media' => 'all', |
283 | 283 | ), |
284 | 284 | 'simcal-default-calendar-list' => array( |
285 | - 'src' => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $this->min . '.css', |
|
285 | + 'src' => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$this->min.'.css', |
|
286 | 286 | 'deps' => array( |
287 | 287 | 'simcal-qtip', |
288 | 288 | ), |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'advanced'; |
31 | 31 | $this->option_group = 'settings'; |
32 | - $this->label = __( 'Advanced', 'google-calendar-events' ); |
|
32 | + $this->label = __('Advanced', 'google-calendar-events'); |
|
33 | 33 | //$this->description = __( 'Advanced settings.', 'google-calendar-events' ); |
34 | 34 | $this->sections = $this->add_sections(); |
35 | 35 | $this->fields = $this->add_fields(); |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | * @return array |
44 | 44 | */ |
45 | 45 | public function add_sections() { |
46 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', array( |
|
46 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', array( |
|
47 | 47 | 'assets' => array( |
48 | - 'title' => __( 'Styles', 'google-calendar-events' ), |
|
49 | - 'description' => __( 'Manage front end assets that handle the calendars appearance.', 'google-calendar-events' ) |
|
48 | + 'title' => __('Styles', 'google-calendar-events'), |
|
49 | + 'description' => __('Manage front end assets that handle the calendars appearance.', 'google-calendar-events') |
|
50 | 50 | ), |
51 | 51 | 'installation' => array( |
52 | - 'title' => __( 'Installation', 'google-calendar-events' ), |
|
53 | - 'description' => __( 'Manage your data (plugin settings and saved calendars).', 'google-calendar-events' ) |
|
52 | + 'title' => __('Installation', 'google-calendar-events'), |
|
53 | + 'description' => __('Manage your data (plugin settings and saved calendars).', 'google-calendar-events') |
|
54 | 54 | ) |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -65,41 +65,41 @@ discard block |
||
65 | 65 | public function add_fields() { |
66 | 66 | |
67 | 67 | $fields = array(); |
68 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
68 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
69 | 69 | |
70 | - foreach ( $this->sections as $section => $a ) : |
|
70 | + foreach ($this->sections as $section => $a) : |
|
71 | 71 | |
72 | - if ( 'assets' == $section ) { |
|
72 | + if ('assets' == $section) { |
|
73 | 73 | |
74 | - $fields[ $section ] = array( |
|
74 | + $fields[$section] = array( |
|
75 | 75 | 'disable_css' => array( |
76 | - 'title' => __( 'Disable CSS', 'google-calendar-events' ), |
|
77 | - 'tooltip' => __( 'If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events' ), |
|
76 | + 'title' => __('Disable CSS', 'google-calendar-events'), |
|
77 | + 'tooltip' => __('If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events'), |
|
78 | 78 | 'type' => 'checkbox', |
79 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_css]', |
|
80 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-css', |
|
81 | - 'value' => $this->get_option_value( $section, 'disable_css' ) |
|
79 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_css]', |
|
80 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-css', |
|
81 | + 'value' => $this->get_option_value($section, 'disable_css') |
|
82 | 82 | ), |
83 | 83 | ); |
84 | 84 | |
85 | - } elseif ( 'installation' == $section ) { |
|
85 | + } elseif ('installation' == $section) { |
|
86 | 86 | |
87 | - $fields[ $section ] = array( |
|
87 | + $fields[$section] = array( |
|
88 | 88 | 'delete_settings' => array( |
89 | - 'title' => __( 'Delete settings', 'google-calendar-events' ), |
|
90 | - 'tooltip' => __( 'Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events' ), |
|
89 | + 'title' => __('Delete settings', 'google-calendar-events'), |
|
90 | + 'tooltip' => __('Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events'), |
|
91 | 91 | 'type' => 'checkbox', |
92 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][delete_settings]', |
|
93 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-delete-settings', |
|
94 | - 'value' => $this->get_option_value( $section, 'delete_settings' ), |
|
92 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][delete_settings]', |
|
93 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-delete-settings', |
|
94 | + 'value' => $this->get_option_value($section, 'delete_settings'), |
|
95 | 95 | ), |
96 | 96 | 'erase_data' => array( |
97 | - 'title' => __( 'Erase calendar data', 'google-calendar-events' ), |
|
98 | - 'tooltip' => __( 'By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events' ), |
|
97 | + 'title' => __('Erase calendar data', 'google-calendar-events'), |
|
98 | + 'tooltip' => __('By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events'), |
|
99 | 99 | 'type' => 'checkbox', |
100 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][erase_data]', |
|
101 | - 'id' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '-delete-data', |
|
102 | - 'value' => $this->get_option_value( $section, 'erase_data' ), |
|
100 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][erase_data]', |
|
101 | + 'id' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'-delete-data', |
|
102 | + 'value' => $this->get_option_value($section, 'erase_data'), |
|
103 | 103 | ) |
104 | 104 | ); |
105 | 105 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | endforeach; |
109 | 109 | |
110 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
110 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } |