@@ -335,7 +335,7 @@ |
||
335 | 335 | */ |
336 | 336 | private function meridiem() { |
337 | 337 | |
338 | - ?> |
|
338 | + ?> |
|
339 | 339 | <div> |
340 | 340 | <label for="<?php echo $this->id; ?>-meridiem"> |
341 | 341 | <?php _e( 'Meridiem', 'google-calendar-events' ); ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param array $field |
44 | 44 | */ |
45 | - public function __construct( $field ) { |
|
45 | + public function __construct($field) { |
|
46 | 46 | |
47 | - $this->subtype = isset( $field['subtype'] ) ? $field['subtype'] : ''; |
|
48 | - $this->type_class = 'simcal-field-datetime-format simcal-field-' . $this->subtype . '-format-field'; |
|
49 | - $this->timestamp = mktime( 13, 10, 00, 1, 1, intval( date( 'Y', time() ) ) + 1 ); |
|
47 | + $this->subtype = isset($field['subtype']) ? $field['subtype'] : ''; |
|
48 | + $this->type_class = 'simcal-field-datetime-format simcal-field-'.$this->subtype.'-format-field'; |
|
49 | + $this->timestamp = mktime(13, 10, 00, 1, 1, intval(date('Y', time())) + 1); |
|
50 | 50 | |
51 | - parent::__construct( $field ); |
|
51 | + parent::__construct($field); |
|
52 | 52 | |
53 | - if ( empty( $this->value ) ) { |
|
54 | - if ( 'date' == $this->subtype ) { |
|
53 | + if (empty($this->value)) { |
|
54 | + if ('date' == $this->subtype) { |
|
55 | 55 | $this->value = 'l, d F Y'; |
56 | 56 | } |
57 | - if ( 'time' == $this->subtype ) { |
|
57 | + if ('time' == $this->subtype) { |
|
58 | 58 | $this->value = 'G:i a'; |
59 | 59 | } |
60 | 60 | } |
@@ -67,36 +67,36 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function html() { |
69 | 69 | |
70 | - $id = $this->id ? ' id="' . $this->id . '" ' : ''; |
|
71 | - $class = $this->class ? ' class="' . $this->class . '" ' : ''; |
|
72 | - $style = $this->style ? ' style="' . $this->style . '" ' : ''; |
|
70 | + $id = $this->id ? ' id="'.$this->id.'" ' : ''; |
|
71 | + $class = $this->class ? ' class="'.$this->class.'" ' : ''; |
|
72 | + $style = $this->style ? ' style="'.$this->style.'" ' : ''; |
|
73 | 73 | $attr = $this->attributes; |
74 | 74 | |
75 | 75 | ?> |
76 | - <div <?php echo $id . $class . $style . $attr; ?>> |
|
76 | + <div <?php echo $id.$class.$style.$attr; ?>> |
|
77 | 77 | <?php |
78 | 78 | |
79 | - if ( ! empty( $this->description ) ) { |
|
80 | - echo '<p class="description">' . $this->description . '</p>'; |
|
79 | + if ( ! empty($this->description)) { |
|
80 | + echo '<p class="description">'.$this->description.'</p>'; |
|
81 | 81 | } |
82 | 82 | |
83 | - $matches = array_unique( str_split( $this->value ) ); |
|
83 | + $matches = array_unique(str_split($this->value)); |
|
84 | 84 | |
85 | - if ( 'date' == $this->subtype ) { |
|
86 | - $this->print_date( $matches ); |
|
85 | + if ('date' == $this->subtype) { |
|
86 | + $this->print_date($matches); |
|
87 | 87 | } |
88 | 88 | |
89 | - if ( 'time' == $this->subtype ) { |
|
90 | - $this->print_time( $matches ); |
|
89 | + if ('time' == $this->subtype) { |
|
90 | + $this->print_time($matches); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | ?> |
94 | 94 | <input type="hidden" |
95 | 95 | name="<?php echo $this->name; ?>" |
96 | - value="<?php echo trim( $this->value ); ?>" /> |
|
96 | + value="<?php echo trim($this->value); ?>" /> |
|
97 | 97 | <span> |
98 | - <em><?php _e( 'Preview', 'google-calendar-events' ); ?>:</em> |
|
99 | - <code><?php echo date_i18n( $this->value, $this->timestamp ); ?></code> |
|
98 | + <em><?php _e('Preview', 'google-calendar-events'); ?>:</em> |
|
99 | + <code><?php echo date_i18n($this->value, $this->timestamp); ?></code> |
|
100 | 100 | </span> |
101 | 101 | </div> |
102 | 102 | <?php |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param array $matches |
113 | 113 | */ |
114 | - private function print_date( $matches ) { |
|
114 | + private function print_date($matches) { |
|
115 | 115 | |
116 | - $date = array( 'weekday' => '', 'divider' => '', 'day' => '', 'month' => '', 'year' => '' ); |
|
116 | + $date = array('weekday' => '', 'divider' => '', 'day' => '', 'month' => '', 'year' => ''); |
|
117 | 117 | |
118 | - foreach ( $matches as $match ) { |
|
119 | - if ( in_array( $match, array( 'D', 'l' ) ) ) { |
|
118 | + foreach ($matches as $match) { |
|
119 | + if (in_array($match, array('D', 'l'))) { |
|
120 | 120 | $this->weekday(); |
121 | - unset( $date['weekday'] ); |
|
122 | - } elseif ( in_array( $match, array( 'd', 'j' ) ) ) { |
|
121 | + unset($date['weekday']); |
|
122 | + } elseif (in_array($match, array('d', 'j'))) { |
|
123 | 123 | $this->day(); |
124 | - unset( $date['day'] ); |
|
125 | - } elseif ( in_array( $match, array( 'F', 'M', 'm', 'n' ) ) ) { |
|
124 | + unset($date['day']); |
|
125 | + } elseif (in_array($match, array('F', 'M', 'm', 'n'))) { |
|
126 | 126 | $this->month(); |
127 | - unset( $date['month'] ); |
|
128 | - } elseif ( in_array( $match, array( 'y', 'Y' ) ) ) { |
|
127 | + unset($date['month']); |
|
128 | + } elseif (in_array($match, array('y', 'Y'))) { |
|
129 | 129 | $this->year(); |
130 | - unset( $date['year'] ); |
|
131 | - } elseif ( in_array( $match, array( '.', ',', ':', '/', '-' ) ) ) { |
|
130 | + unset($date['year']); |
|
131 | + } elseif (in_array($match, array('.', ',', ':', '/', '-'))) { |
|
132 | 132 | $this->divider(); |
133 | - unset( $date['divider'] ); |
|
133 | + unset($date['divider']); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - $this->print_fields( $date ); |
|
137 | + $this->print_fields($date); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,27 +145,27 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param array $matches |
147 | 147 | */ |
148 | - private function print_time( $matches ) { |
|
148 | + private function print_time($matches) { |
|
149 | 149 | |
150 | - $time = array( 'hours' => '', 'divider' => '', 'minutes' => '', 'meridiem' => '' ); |
|
150 | + $time = array('hours' => '', 'divider' => '', 'minutes' => '', 'meridiem' => ''); |
|
151 | 151 | |
152 | - foreach ( $matches as $match ) { |
|
153 | - if ( in_array( $match, array( 'h', 'H', 'g', 'G' ) ) ) { |
|
152 | + foreach ($matches as $match) { |
|
153 | + if (in_array($match, array('h', 'H', 'g', 'G'))) { |
|
154 | 154 | $this->hours(); |
155 | - unset( $time['hours'] ); |
|
156 | - } elseif ( in_array( $match, array( 'i' ) ) ) { |
|
155 | + unset($time['hours']); |
|
156 | + } elseif (in_array($match, array('i'))) { |
|
157 | 157 | $this->minutes(); |
158 | - unset( $time['minutes'] ); |
|
159 | - } elseif ( in_array( $match, array( 'A', 'a' ) ) ) { |
|
158 | + unset($time['minutes']); |
|
159 | + } elseif (in_array($match, array('A', 'a'))) { |
|
160 | 160 | $this->meridiem(); |
161 | - unset( $time['meridiem'] ); |
|
162 | - } elseif ( in_array( $match, array( '.', ',', ':', '/', '-' ) ) ) { |
|
161 | + unset($time['meridiem']); |
|
162 | + } elseif (in_array($match, array('.', ',', ':', '/', '-'))) { |
|
163 | 163 | $this->divider(); |
164 | - unset( $time['divider'] ); |
|
164 | + unset($time['divider']); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $this->print_fields( $time ); |
|
168 | + $this->print_fields($time); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param $fields |
178 | 178 | */ |
179 | - private function print_fields( $fields ) { |
|
180 | - if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
181 | - foreach ( $fields as $func => $v ) { |
|
182 | - if ( method_exists( $this, $func ) ) { |
|
179 | + private function print_fields($fields) { |
|
180 | + if ( ! empty($fields) && is_array($fields)) { |
|
181 | + foreach ($fields as $func => $v) { |
|
182 | + if (method_exists($this, $func)) { |
|
183 | 183 | $this->$func(); |
184 | 184 | }; |
185 | 185 | } |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | ?> |
198 | 198 | <div> |
199 | 199 | <label for="<?php echo $this->id; ?>-weekday"> |
200 | - <?php _e( 'Weekday', 'google-calendar-events' ); ?> |
|
200 | + <?php _e('Weekday', 'google-calendar-events'); ?> |
|
201 | 201 | <select name="" id="<?php echo $this->id; ?>-weekday"> |
202 | 202 | <option value="" data-preview=""></option> |
203 | - <option value="D" <?php selected( 'D', strpbrk( 'D', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'D', $this->timestamp ); ?>"><?php echo date_i18n( 'D', $this->timestamp ); ?></option> |
|
204 | - <option value="l" <?php selected( 'l', strpbrk( 'l', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'l', $this->timestamp ); ?>"><?php echo date_i18n( 'l', $this->timestamp ); ?></option> |
|
203 | + <option value="D" <?php selected('D', strpbrk('D', $this->value)) ?> data-preview="<?php echo date_i18n('D', $this->timestamp); ?>"><?php echo date_i18n('D', $this->timestamp); ?></option> |
|
204 | + <option value="l" <?php selected('l', strpbrk('l', $this->value)) ?> data-preview="<?php echo date_i18n('l', $this->timestamp); ?>"><?php echo date_i18n('l', $this->timestamp); ?></option> |
|
205 | 205 | </select> |
206 | 206 | </label> |
207 | 207 | </div> |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | ?> |
221 | 221 | <div> |
222 | 222 | <label for="<?php echo $this->id; ?>-day"> |
223 | - <?php _e( 'Day', 'google-calendar-events' ); ?> |
|
223 | + <?php _e('Day', 'google-calendar-events'); ?> |
|
224 | 224 | <select name="" id="<?php echo $this->id; ?>-day"> |
225 | 225 | <option value="" data-preview=""></option> |
226 | - <option value="j" <?php selected( 'j', strpbrk( 'j', $this->value ) ) ?> data-preview="<?php echo date( 'j', $this->timestamp ); ?>"><?php echo date( 'j', $this->timestamp ); ?></option> |
|
227 | - <option value="d" <?php selected( 'd', strpbrk( 'd', $this->value ) ) ?> data-preview="<?php echo date( 'd', $this->timestamp ); ?>"><?php echo date( 'd', $this->timestamp ); ?></option> |
|
226 | + <option value="j" <?php selected('j', strpbrk('j', $this->value)) ?> data-preview="<?php echo date('j', $this->timestamp); ?>"><?php echo date('j', $this->timestamp); ?></option> |
|
227 | + <option value="d" <?php selected('d', strpbrk('d', $this->value)) ?> data-preview="<?php echo date('d', $this->timestamp); ?>"><?php echo date('d', $this->timestamp); ?></option> |
|
228 | 228 | </select> |
229 | 229 | </label> |
230 | 230 | </div> |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | ?> |
244 | 244 | <div> |
245 | 245 | <label for="<?php echo $this->id; ?>-month"> |
246 | - <?php _e( 'Month', 'google-calendar-events' ); ?> |
|
246 | + <?php _e('Month', 'google-calendar-events'); ?> |
|
247 | 247 | <select name="" id="<?php echo $this->id; ?>-month"> |
248 | 248 | <option value="" data-preview=""></option> |
249 | - <option value="F" <?php selected( 'F', strpbrk( 'F', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'F', $this->timestamp ); ?>"><?php echo date_i18n( 'F', $this->timestamp ); ?></option> |
|
250 | - <option value="M" <?php selected( 'M', strpbrk( 'M', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'M', $this->timestamp ); ?>"><?php echo date_i18n( 'M', $this->timestamp ); ?></option> |
|
251 | - <option value="m" <?php selected( 'm', strpbrk( 'm', $this->value ) ) ?> data-preview="<?php echo date( 'm', $this->timestamp ); ?>"><?php echo date( 'm', $this->timestamp ); ?></option> |
|
252 | - <option value="n" <?php selected( 'n', strpbrk( 'n', $this->value ) ) ?> data-preview="<?php echo date( 'n', $this->timestamp ); ?>"><?php echo date( 'n', $this->timestamp ); ?></option> |
|
249 | + <option value="F" <?php selected('F', strpbrk('F', $this->value)) ?> data-preview="<?php echo date_i18n('F', $this->timestamp); ?>"><?php echo date_i18n('F', $this->timestamp); ?></option> |
|
250 | + <option value="M" <?php selected('M', strpbrk('M', $this->value)) ?> data-preview="<?php echo date_i18n('M', $this->timestamp); ?>"><?php echo date_i18n('M', $this->timestamp); ?></option> |
|
251 | + <option value="m" <?php selected('m', strpbrk('m', $this->value)) ?> data-preview="<?php echo date('m', $this->timestamp); ?>"><?php echo date('m', $this->timestamp); ?></option> |
|
252 | + <option value="n" <?php selected('n', strpbrk('n', $this->value)) ?> data-preview="<?php echo date('n', $this->timestamp); ?>"><?php echo date('n', $this->timestamp); ?></option> |
|
253 | 253 | </select> |
254 | 254 | </label> |
255 | 255 | </div> |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | ?> |
269 | 269 | <div> |
270 | 270 | <label for="<?php echo $this->id; ?>-year"> |
271 | - <?php _e( 'Year', 'google-calendar-events' ); ?> |
|
271 | + <?php _e('Year', 'google-calendar-events'); ?> |
|
272 | 272 | <select name="" id="<?php echo $this->id; ?>-year"> |
273 | 273 | <option value="" data-preview=""></option> |
274 | - <option value="Y" <?php selected( 'Y', strpbrk( 'Y', $this->value ) ) ?> data-preview="<?php echo date( 'Y', $this->timestamp ); ?>"><?php echo date( 'Y', $this->timestamp ); ?></option> |
|
275 | - <option value="y" <?php selected( 'y', strpbrk( 'y', $this->value ) ) ?> data-preview="<?php echo date( 'y', $this->timestamp ); ?>"><?php echo date( 'y', $this->timestamp ); ?></option> |
|
274 | + <option value="Y" <?php selected('Y', strpbrk('Y', $this->value)) ?> data-preview="<?php echo date('Y', $this->timestamp); ?>"><?php echo date('Y', $this->timestamp); ?></option> |
|
275 | + <option value="y" <?php selected('y', strpbrk('y', $this->value)) ?> data-preview="<?php echo date('y', $this->timestamp); ?>"><?php echo date('y', $this->timestamp); ?></option> |
|
276 | 276 | </select> |
277 | 277 | </label> |
278 | 278 | </div> |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | ?> |
292 | 292 | <div> |
293 | 293 | <label for="<?php echo $this->id; ?>-hours"> |
294 | - <?php _e( 'Hours', 'google-calendar-events' ) ?> |
|
294 | + <?php _e('Hours', 'google-calendar-events') ?> |
|
295 | 295 | <select name="" id="<?php echo $this->id; ?>-hours"> |
296 | 296 | <option value="" data-preview=""></option> |
297 | - <option value="g" <?php selected( 'g', strpbrk( 'g', $this->value ) ); ?> data-preview="<?php echo date( 'g', $this->timestamp ); ?>"><?php echo date( 'g', $this->timestamp ) . ' (12h)'; ?></option> |
|
298 | - <option value="G" <?php selected( 'G', strpbrk( 'G', $this->value ) ); ?> data-preview="<?php echo date( 'G', $this->timestamp - 43200 ); ?>"><?php echo date( 'G', $this->timestamp - 43200 ) . ' (24h)'; ?></option> |
|
299 | - <option value="h" <?php selected( 'h', strpbrk( 'h', $this->value ) ); ?> data-preview="<?php echo date( 'h', $this->timestamp ); ?>"><?php echo date( 'h', $this->timestamp ) . ' (12h)'; ?></option> |
|
300 | - <option value="H" <?php selected( 'H', strpbrk( 'H', $this->value ) ); ?> data-preview="<?php echo date( 'H', $this->timestamp - 43200 ); ?>"><?php echo date( 'H', $this->timestamp - 43200 ) . ' (24h)'; ?></option> |
|
297 | + <option value="g" <?php selected('g', strpbrk('g', $this->value)); ?> data-preview="<?php echo date('g', $this->timestamp); ?>"><?php echo date('g', $this->timestamp).' (12h)'; ?></option> |
|
298 | + <option value="G" <?php selected('G', strpbrk('G', $this->value)); ?> data-preview="<?php echo date('G', $this->timestamp - 43200); ?>"><?php echo date('G', $this->timestamp - 43200).' (24h)'; ?></option> |
|
299 | + <option value="h" <?php selected('h', strpbrk('h', $this->value)); ?> data-preview="<?php echo date('h', $this->timestamp); ?>"><?php echo date('h', $this->timestamp).' (12h)'; ?></option> |
|
300 | + <option value="H" <?php selected('H', strpbrk('H', $this->value)); ?> data-preview="<?php echo date('H', $this->timestamp - 43200); ?>"><?php echo date('H', $this->timestamp - 43200).' (24h)'; ?></option> |
|
301 | 301 | </select> |
302 | 302 | </label> |
303 | 303 | </div> |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | ?> |
317 | 317 | <div> |
318 | 318 | <label for="<?php echo $this->id; ?>-minutes"> |
319 | - <?php _e( 'Minutes', 'google-calendar-events' ); ?> |
|
319 | + <?php _e('Minutes', 'google-calendar-events'); ?> |
|
320 | 320 | <select name="" id="<?php echo $this->id; ?>-minutes"> |
321 | 321 | <option value="" data-preview=""></option> |
322 | - <option value="i" <?php selected( 'i', strpbrk( 'i', $this->value ) ); ?> data-preview="<?php echo date( 'i', $this->timestamp ); ?>"><?php echo date( 'i', $this->timestamp ); ?></option> |
|
322 | + <option value="i" <?php selected('i', strpbrk('i', $this->value)); ?> data-preview="<?php echo date('i', $this->timestamp); ?>"><?php echo date('i', $this->timestamp); ?></option> |
|
323 | 323 | </select> |
324 | 324 | </label> |
325 | 325 | </div> |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | ?> |
339 | 339 | <div> |
340 | 340 | <label for="<?php echo $this->id; ?>-meridiem"> |
341 | - <?php _e( 'Meridiem', 'google-calendar-events' ); ?> |
|
341 | + <?php _e('Meridiem', 'google-calendar-events'); ?> |
|
342 | 342 | <select name="" id="<?php echo $this->id; ?>-meridiem"> |
343 | 343 | <option value="" data-preview=""></option> |
344 | - <option value="a" <?php selected( 'a', strpbrk( 'a', $this->value ) ); ?> data-preview="<?php echo date( 'a', $this->timestamp ); ?>"><?php echo date( 'a', $this->timestamp ); ?></option> |
|
345 | - <option value="A" <?php selected( 'A', strpbrk( 'A', $this->value ) ); ?> data-preview="<?php echo date( 'A', $this->timestamp ); ?>"><?php echo date( 'A', $this->timestamp ); ?></option> |
|
344 | + <option value="a" <?php selected('a', strpbrk('a', $this->value)); ?> data-preview="<?php echo date('a', $this->timestamp); ?>"><?php echo date('a', $this->timestamp); ?></option> |
|
345 | + <option value="A" <?php selected('A', strpbrk('A', $this->value)); ?> data-preview="<?php echo date('A', $this->timestamp); ?>"><?php echo date('A', $this->timestamp); ?></option> |
|
346 | 346 | </select> |
347 | 347 | </label> |
348 | 348 | </div> |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | ?> |
362 | 362 | <div> |
363 | 363 | <label for="<?php echo $this->id; ?>-divider"> |
364 | - <?php _ex( 'Divider', 'A character to separate two elements', 'google-calendar-events' ); ?> |
|
364 | + <?php _ex('Divider', 'A character to separate two elements', 'google-calendar-events'); ?> |
|
365 | 365 | <select name="" id="<?php echo $this->id; ?>-divider"> |
366 | 366 | <option value="" data-preview=""></option> |
367 | - <option value="." <?php selected( '.', strpbrk( '.', $this->value ) ); ?> data-preview="." data-trim="true">.</option> |
|
368 | - <option value=", " <?php selected( ',', strpbrk( ',', $this->value ) ); ?> data-preview=", " data-trim="true">,</option> |
|
369 | - <option value=":" <?php selected( ':', strpbrk( ':', $this->value ) ); ?> data-preview=":" data-trim="true">:</option> |
|
370 | - <option value="-" <?php selected( '-', strpbrk( '-', $this->value ) ); ?> data-preview="-" data-trim="true">-</option> |
|
371 | - <option value="/" <?php selected( '/', strpbrk( '/', $this->value ) ); ?> data-preview="/" data-trim="true">/</option> |
|
367 | + <option value="." <?php selected('.', strpbrk('.', $this->value)); ?> data-preview="." data-trim="true">.</option> |
|
368 | + <option value=", " <?php selected(',', strpbrk(',', $this->value)); ?> data-preview=", " data-trim="true">,</option> |
|
369 | + <option value=":" <?php selected(':', strpbrk(':', $this->value)); ?> data-preview=":" data-trim="true">:</option> |
|
370 | + <option value="-" <?php selected('-', strpbrk('-', $this->value)); ?> data-preview="-" data-trim="true">-</option> |
|
371 | + <option value="/" <?php selected('/', strpbrk('/', $this->value)); ?> data-preview="/" data-trim="true">/</option> |
|
372 | 372 | </select> |
373 | 373 | </label> |
374 | 374 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $field |
36 | 36 | */ |
37 | - public function __construct( $field ) { |
|
38 | - $this->addon = isset( $field['addon'] ) ? esc_attr( $field['addon'] ) : ''; |
|
37 | + public function __construct($field) { |
|
38 | + $this->addon = isset($field['addon']) ? esc_attr($field['addon']) : ''; |
|
39 | 39 | $this->type_class = 'simcal-field-license'; |
40 | - parent::__construct( $field ); |
|
40 | + parent::__construct($field); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function html() { |
49 | 49 | |
50 | - if ( ! empty( $this->addon ) ) { |
|
50 | + if ( ! empty($this->addon)) { |
|
51 | 51 | |
52 | - $status = simcal_get_license_status( $this->addon ); |
|
52 | + $status = simcal_get_license_status($this->addon); |
|
53 | 53 | |
54 | - if ( empty( $status ) || in_array( $status, array( 'valid', 'invalid', 'deactivated' ) ) ) { |
|
54 | + if (empty($status) || in_array($status, array('valid', 'invalid', 'deactivated'))) { |
|
55 | 55 | $display_activate = 'display: inline-block'; |
56 | 56 | $display_deactivate = 'display: none'; |
57 | 57 | $active = 'valid' == $status ? 'display: block' : 'display: none'; |
58 | - $disabled = ''; |
|
58 | + $disabled = ''; |
|
59 | 59 | } else { |
60 | 60 | $display_activate = $active = 'display: none'; |
61 | 61 | $display_deactivate = 'display: inline-block'; |
62 | - $disabled = empty( $this->value ) ? '' : 'disabled="disabled"'; |
|
62 | + $disabled = empty($this->value) ? '' : 'disabled="disabled"'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | ?> |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | <span class="simcal-addon-manage-license-buttons"> |
75 | 75 | |
76 | 76 | <button class="button-secondary simcal-addon-manage-license deactivate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_deactivate; ?>"> |
77 | - <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Deactivate', 'google-calendar-events' ); ?> |
|
77 | + <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Deactivate', 'google-calendar-events'); ?> |
|
78 | 78 | </button> |
79 | 79 | |
80 | 80 | <button class="button-secondary simcal-addon-manage-license activate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_activate; ?>"> |
81 | - <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Activate', 'google-calendar-events' ); ?> |
|
81 | + <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Activate', 'google-calendar-events'); ?> |
|
82 | 82 | </button> |
83 | 83 | |
84 | 84 | <span class="error" style="color: red; display: none"> </span> |
85 | 85 | |
86 | - <strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e( '(active)', 'google-calendar-events' ); ?></strong> |
|
86 | + <strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e('(active)', 'google-calendar-events'); ?></strong> |
|
87 | 87 | |
88 | 88 | </span> |
89 | 89 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $field |
28 | 28 | */ |
29 | - public function __construct( $field ) { |
|
30 | - parent::__construct( $field ); |
|
29 | + public function __construct($field) { |
|
30 | + parent::__construct($field); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 3.0.0 |
37 | 37 | */ |
38 | 38 | public function html() { |
39 | - wp_nonce_field( $this->name, $this->value ); |
|
39 | + wp_nonce_field($this->name, $this->value); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param array $field |
38 | 38 | */ |
39 | - public function __construct( $field ) { |
|
39 | + public function __construct($field) { |
|
40 | 40 | |
41 | 41 | $this->type_class = 'simcal-field-radios'; |
42 | - $this->inline = isset( $field['inline'] ) ? ( 'inline' == $field['inline'] ? true : false ) : false; |
|
42 | + $this->inline = isset($field['inline']) ? ('inline' == $field['inline'] ? true : false) : false; |
|
43 | 43 | |
44 | - parent::__construct( $field ); |
|
44 | + parent::__construct($field); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | ?> |
55 | 55 | <fieldset id="<?php echo $this->id; ?>" |
56 | 56 | class="<?php echo $this->class; ?>" |
57 | - <?php echo $this->style ? 'style="' . $this->style .'"' : ''; ?>> |
|
57 | + <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?>> |
|
58 | 58 | <?php |
59 | 59 | |
60 | - echo $this->description ? '<p class="description">' . wp_kses_post( $this->description ) . '</p>' : ''; |
|
60 | + echo $this->description ? '<p class="description">'.wp_kses_post($this->description).'</p>' : ''; |
|
61 | 61 | |
62 | - if ( ! empty( $this->title ) ) : |
|
62 | + if ( ! empty($this->title)) : |
|
63 | 63 | |
64 | 64 | ?> |
65 | 65 | <legend class="screen-reader-text"> |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | |
72 | 72 | ?> |
73 | 73 | <ul <?php echo $this->inline === true ? 'class="simcal-field-radios-inline"' : ''; ?>> |
74 | - <?php foreach ( $this->options as $option => $name ) : ?> |
|
74 | + <?php foreach ($this->options as $option => $name) : ?> |
|
75 | 75 | <li> |
76 | - <label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"> |
|
76 | + <label for="<?php echo $this->id.'-'.trim(strval($option)); ?>"> |
|
77 | 77 | <input name="<?php echo $this->name; ?>" |
78 | - id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>" |
|
78 | + id="<?php echo $this->id.'-'.trim(strval($option)); ?>" |
|
79 | 79 | class="simcal-field simcal-field-radio" |
80 | 80 | type="radio" |
81 | - value="<?php echo trim( strval( $option ) ); ?>" |
|
81 | + value="<?php echo trim(strval($option)); ?>" |
|
82 | 82 | <?php echo $this->attributes; ?> |
83 | - <?php checked( $option, $this->value, true ); ?> |
|
83 | + <?php checked($option, $this->value, true); ?> |
|
84 | 84 | /> |
85 | - <?php echo esc_attr( $name ); ?> |
|
85 | + <?php echo esc_attr($name); ?> |
|
86 | 86 | </label> |
87 | 87 | </li> |
88 | 88 | <?php endforeach; ?> |
@@ -57,7 +57,7 @@ |
||
57 | 57 | value="<?php echo $this->value; ?>" |
58 | 58 | class="<?php echo $this->class; ?>"<?php |
59 | 59 | echo $this->style ? 'style="' . $this->style . '" ' : ' '; |
60 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
60 | + echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
61 | 61 | echo $this->attributes; ?>/> |
62 | 62 | <?php |
63 | 63 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param array $field |
37 | 37 | */ |
38 | - public function __construct( $field ) { |
|
38 | + public function __construct($field) { |
|
39 | 39 | |
40 | - $this->subtype = isset( $field['subtype'] ) ? esc_attr( $field['subtype'] ) : 'text'; |
|
41 | - $this->type_class = 'simcal-field-' . $this->subtype; |
|
40 | + $this->subtype = isset($field['subtype']) ? esc_attr($field['subtype']) : 'text'; |
|
41 | + $this->type_class = 'simcal-field-'.$this->subtype; |
|
42 | 42 | |
43 | - parent::__construct( $field ); |
|
43 | + parent::__construct($field); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | id="<?php echo $this->id; ?>" |
57 | 57 | value="<?php echo $this->value; ?>" |
58 | 58 | class="<?php echo $this->class; ?>"<?php |
59 | - echo $this->style ? 'style="' . $this->style . '" ' : ' '; |
|
60 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
59 | + echo $this->style ? 'style="'.$this->style.'" ' : ' '; |
|
60 | + echo $this->placeholder ? 'placeholder="'.$this->placeholder.'"' : ' '; |
|
61 | 61 | echo $this->attributes; ?>/> |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | echo $this->tooltip; |
65 | 65 | |
66 | - if ( ! empty( $this->description ) ) { |
|
67 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
66 | + if ( ! empty($this->description)) { |
|
67 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
68 | 68 | } |
69 | 69 | |
70 | - if ( is_string( $this->validation ) && ! empty ( $this->validation ) ) { |
|
70 | + if (is_string($this->validation) && ! empty ($this->validation)) { |
|
71 | 71 | echo $this->validation; |
72 | 72 | } |
73 | 73 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $field |
28 | 28 | */ |
29 | - public function __construct( $field ) { |
|
29 | + public function __construct($field) { |
|
30 | 30 | |
31 | 31 | $this->type_class = 'simcal-field-textarea'; |
32 | 32 | |
33 | - parent::__construct( $field ); |
|
33 | + parent::__construct($field); |
|
34 | 34 | |
35 | - if ( ! empty( $field['value'] ) ) { |
|
36 | - $this->value = esc_textarea( $field['value'] ); |
|
35 | + if ( ! empty($field['value'])) { |
|
36 | + $this->value = esc_textarea($field['value']); |
|
37 | 37 | } |
38 | - if ( ! empty( $field['default'] ) ) { |
|
39 | - $this->default = esc_textarea( $field['default'] ); |
|
38 | + if ( ! empty($field['default'])) { |
|
39 | + $this->default = esc_textarea($field['default']); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | name="<?php echo $this->name; ?>" |
53 | 53 | id="<?php echo $this->id; ?>" |
54 | 54 | <?php |
55 | - echo $this->class ? 'class="' . $this->class . '" ' : ''; |
|
56 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '" ' : ''; |
|
57 | - echo $this->style ? 'style="' . $this->style . '" ' : ''; |
|
55 | + echo $this->class ? 'class="'.$this->class.'" ' : ''; |
|
56 | + echo $this->placeholder ? 'placeholder="'.$this->placeholder.'" ' : ''; |
|
57 | + echo $this->style ? 'style="'.$this->style.'" ' : ''; |
|
58 | 58 | echo $this->attributes; |
59 | - ?>><?php echo $this->value; ?></textarea> |
|
59 | + ?>><?php echo $this->value; ?></textarea> |
|
60 | 60 | <?php |
61 | 61 | |
62 | 62 | echo $this->tooltip; |
63 | 63 | |
64 | - if ( ! empty( $this->description ) ) { |
|
65 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
64 | + if ( ! empty($this->description)) { |
|
65 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | } |
@@ -146,11 +146,11 @@ |
||
146 | 146 | $links = array(); |
147 | 147 | $links['github'] = '<a href="' . simcal_get_url( 'github' ) . '" target="_blank" >GitHub</a>'; |
148 | 148 | $links['documentation'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
149 | - __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
149 | + __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
150 | 150 | $links['support'] = '<a href="' . simcal_get_url( 'support' ) . '" target="_blank" >' . |
151 | - __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
151 | + __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
152 | 152 | $links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
153 | - __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
153 | + __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
154 | 154 | |
155 | 155 | return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) ); |
156 | 156 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Admin; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | |
45 | 45 | self::$main_menu = 'edit.php?post_type=calendar'; |
46 | 46 | |
47 | - add_action( 'admin_menu', array( __CLASS__, 'add_menu_items' ) ); |
|
47 | + add_action('admin_menu', array(__CLASS__, 'add_menu_items')); |
|
48 | 48 | |
49 | - self::$plugin = plugin_basename( SIMPLE_CALENDAR_MAIN_FILE ); |
|
49 | + self::$plugin = plugin_basename(SIMPLE_CALENDAR_MAIN_FILE); |
|
50 | 50 | |
51 | 51 | new Welcome(); |
52 | 52 | |
53 | 53 | // Links and meta content in plugins page. |
54 | - add_filter( 'plugin_action_links_' . self::$plugin, array( __CLASS__, 'plugin_action_links' ), 10, 5 ); |
|
55 | - add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 ); |
|
54 | + add_filter('plugin_action_links_'.self::$plugin, array(__CLASS__, 'plugin_action_links'), 10, 5); |
|
55 | + add_filter('plugin_row_meta', array(__CLASS__, 'plugin_row_meta'), 10, 2); |
|
56 | 56 | // Custom text in admin footer. |
57 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
57 | + add_filter('admin_footer_text', array($this, 'admin_footer_text'), 1); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -66,41 +66,41 @@ discard block |
||
66 | 66 | |
67 | 67 | add_submenu_page( |
68 | 68 | self::$main_menu, |
69 | - __( 'Settings', 'google-calendar-events' ), |
|
70 | - __( 'Settings', 'google-calendar-events' ), |
|
69 | + __('Settings', 'google-calendar-events'), |
|
70 | + __('Settings', 'google-calendar-events'), |
|
71 | 71 | 'manage_options', |
72 | 72 | 'simple-calendar_settings', |
73 | - function () { |
|
74 | - $page = new Pages( 'settings' ); |
|
73 | + function() { |
|
74 | + $page = new Pages('settings'); |
|
75 | 75 | $page->html(); |
76 | 76 | } |
77 | 77 | ); |
78 | 78 | |
79 | 79 | add_submenu_page( |
80 | 80 | self::$main_menu, |
81 | - __( 'Add-ons', 'google-calendar-events' ), |
|
82 | - __( 'Add-ons', 'google-calendar-events' ), |
|
81 | + __('Add-ons', 'google-calendar-events'), |
|
82 | + __('Add-ons', 'google-calendar-events'), |
|
83 | 83 | 'manage_options', |
84 | 84 | 'simple-calendar_add_ons', |
85 | 85 | function() { |
86 | - $page = new Pages( 'add-ons' ); |
|
86 | + $page = new Pages('add-ons'); |
|
87 | 87 | $page->html(); |
88 | 88 | } |
89 | 89 | ); |
90 | 90 | |
91 | 91 | add_submenu_page( |
92 | 92 | self::$main_menu, |
93 | - __( 'Tools', 'google-calendar-events' ), |
|
94 | - __( 'Tools', 'google-calendar-events' ), |
|
93 | + __('Tools', 'google-calendar-events'), |
|
94 | + __('Tools', 'google-calendar-events'), |
|
95 | 95 | 'manage_options', |
96 | 96 | 'simple-calendar_tools', |
97 | - function () { |
|
98 | - $page = new Pages( 'tools' ); |
|
97 | + function() { |
|
98 | + $page = new Pages('tools'); |
|
99 | 99 | $page->html(); |
100 | 100 | } |
101 | 101 | ); |
102 | 102 | |
103 | - do_action( 'simcal_admin_add_menu_items' ); |
|
103 | + do_action('simcal_admin_add_menu_items'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public static function plugin_action_links( $action_links, $file ) { |
|
116 | + public static function plugin_action_links($action_links, $file) { |
|
117 | 117 | |
118 | - if ( self::$plugin == $file ) { |
|
118 | + if (self::$plugin == $file) { |
|
119 | 119 | |
120 | 120 | $links = array(); |
121 | - $links['settings'] = '<a href="' . admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings' ) . '">' . __( 'Settings', 'google-calendar-events' ) . '</a>'; |
|
122 | - $links['feeds'] = '<a href="' . admin_url( 'edit.php?post_type=calendar' ) . '">' . __( 'Calendars', 'google-calendar-events' ) . '</a>'; |
|
121 | + $links['settings'] = '<a href="'.admin_url('edit.php?post_type=calendar&page=simple-calendar_settings').'">'.__('Settings', 'google-calendar-events').'</a>'; |
|
122 | + $links['feeds'] = '<a href="'.admin_url('edit.php?post_type=calendar').'">'.__('Calendars', 'google-calendar-events').'</a>'; |
|
123 | 123 | |
124 | - return apply_filters( 'simcal_plugin_action_links', array_merge( $links, $action_links ) ); |
|
124 | + return apply_filters('simcal_plugin_action_links', array_merge($links, $action_links)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | return $action_links; |
@@ -137,20 +137,20 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - public static function plugin_row_meta( $meta_links, $file ) { |
|
140 | + public static function plugin_row_meta($meta_links, $file) { |
|
141 | 141 | |
142 | - if ( self::$plugin == $file ) { |
|
142 | + if (self::$plugin == $file) { |
|
143 | 143 | |
144 | 144 | $links = array(); |
145 | - $links['github'] = '<a href="' . simcal_get_url( 'github' ) . '" target="_blank" >GitHub</a>'; |
|
146 | - $links['documentation'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
|
147 | - __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
148 | - $links['support'] = '<a href="' . simcal_get_url( 'support' ) . '" target="_blank" >' . |
|
149 | - __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
150 | - $links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
|
151 | - __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
152 | - |
|
153 | - return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) ); |
|
145 | + $links['github'] = '<a href="'.simcal_get_url('github').'" target="_blank" >GitHub</a>'; |
|
146 | + $links['documentation'] = '<a href="'.simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'plugin-listing').'" target="_blank" >'. |
|
147 | + __('Documentation', 'google-calendar-events').'</a>'; |
|
148 | + $links['support'] = '<a href="'.simcal_get_url('support').'" target="_blank" >'. |
|
149 | + __('Support', 'google-calendar-events').'</a>'; |
|
150 | + $links['add-ons'] = '<a href="'.simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'plugin-listing').'" target="_blank" >'. |
|
151 | + __('Add-ons', 'google-calendar-events').'</a>'; |
|
152 | + |
|
153 | + return apply_filters('simcal_plugin_action_links', array_merge($meta_links, $links)); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | return $meta_links; |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return string|void |
169 | 169 | */ |
170 | - public function admin_footer_text( $footer_text ) { |
|
170 | + public function admin_footer_text($footer_text) { |
|
171 | 171 | |
172 | 172 | // Check to make sure we're on a SimpleCal admin page |
173 | 173 | $screen = simcal_is_admin_screen(); |
174 | - if ( $screen !== false ) { |
|
174 | + if ($screen !== false) { |
|
175 | 175 | |
176 | - if ( 'calendar' == $screen ) { |
|
176 | + if ('calendar' == $screen) { |
|
177 | 177 | |
178 | 178 | // Add Drip promo signup form (@see Newsletter meta box). |
179 | 179 | |
@@ -201,23 +201,23 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | // Change the footer text |
204 | - if ( ! get_option( 'simple-calendar_admin_footer_text_rated' ) ) { |
|
204 | + if ( ! get_option('simple-calendar_admin_footer_text_rated')) { |
|
205 | 205 | |
206 | 206 | $footer_text = sprintf( |
207 | - __( 'If you like <strong>Simple Calendar</strong> please leave us a %s★★★★★ rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events' ), |
|
208 | - '<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'google-calendar-events' ) . '">', '</a>' |
|
207 | + __('If you like <strong>Simple Calendar</strong> please leave us a %s★★★★★ rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events'), |
|
208 | + '<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="'.esc_attr__('Thanks :)', 'google-calendar-events').'">', '</a>' |
|
209 | 209 | ); |
210 | 210 | |
211 | 211 | $footer_text .= '<script type="text/javascript">'; |
212 | 212 | $footer_text .= "jQuery( 'a.simcal-rating-link' ).click( function() { |
213 | - jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url() . "', { action: 'simcal_rated' } ); |
|
213 | + jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url()."', { action: 'simcal_rated' } ); |
|
214 | 214 | jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) ); |
215 | 215 | });"; |
216 | 216 | $footer_text .= '</script>'; |
217 | 217 | |
218 | 218 | } else { |
219 | 219 | |
220 | - $footer_text = __( 'Thank you for using Simple Calendar!', 'google-calendar-events' ); |
|
220 | + $footer_text = __('Thank you for using Simple Calendar!', 'google-calendar-events'); |
|
221 | 221 | |
222 | 222 | } |
223 | 223 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Admin\Metaboxes as Metabox; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | |
47 | - $settings = get_option( 'simple-calendar_settings_calendars' ); |
|
48 | - if ( isset( $settings['general']['attach_calendars_posts'] ) ) { |
|
47 | + $settings = get_option('simple-calendar_settings_calendars'); |
|
48 | + if (isset($settings['general']['attach_calendars_posts'])) { |
|
49 | 49 | $this->post_types = $settings['general']['attach_calendars_posts']; |
50 | 50 | } |
51 | 51 | |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | new Metabox\Settings(); |
54 | 54 | new Metabox\Attach_Calendar(); |
55 | 55 | new Metabox\Newsletter(); |
56 | - do_action( 'simcal_load_meta_boxes' ); |
|
56 | + do_action('simcal_load_meta_boxes'); |
|
57 | 57 | |
58 | 58 | // Add meta boxes. |
59 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 ); |
|
59 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 30); |
|
60 | 60 | |
61 | 61 | // Process meta boxes. |
62 | - add_action( 'simcal_save_settings_meta','\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2 ); |
|
63 | - add_action( 'simcal_save_attach_calendar_meta','\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2 ); |
|
62 | + add_action('simcal_save_settings_meta', '\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2); |
|
63 | + add_action('simcal_save_attach_calendar_meta', '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2); |
|
64 | 64 | |
65 | 65 | // Save meta boxes data. |
66 | - add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 ); |
|
66 | + add_action('save_post', array($this, 'save_meta_boxes'), 1, 2); |
|
67 | 67 | |
68 | 68 | // Uncomment this for debugging $_POST while saving a meta box. |
69 | 69 | // add_action( 'save_post', function() { echo '<pre>'; print_r( $_POST ); echo '</pre>'; die(); } ); |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | |
79 | 79 | add_meta_box( |
80 | 80 | 'simcal-calendar-settings', |
81 | - __( 'Calendar Settings', 'google-calendar-events' ), |
|
81 | + __('Calendar Settings', 'google-calendar-events'), |
|
82 | 82 | '\SimpleCalendar\Admin\Metaboxes\Settings::html', |
83 | 83 | 'calendar', |
84 | 84 | 'normal', |
85 | 85 | 'core' |
86 | 86 | ); |
87 | 87 | |
88 | - $addons = apply_filters( 'simcal_installed_addons', array() ); |
|
89 | - if ( empty( $addons ) ) { |
|
88 | + $addons = apply_filters('simcal_installed_addons', array()); |
|
89 | + if (empty($addons)) { |
|
90 | 90 | |
91 | 91 | add_meta_box( |
92 | 92 | 'simcal-newsletter', |
93 | - __( 'Get 20% off Google Calendar Pro!', 'google-calendar-events' ), |
|
93 | + __('Get 20% off Google Calendar Pro!', 'google-calendar-events'), |
|
94 | 94 | '\SimpleCalendar\Admin\Metaboxes\Newsletter::html', |
95 | 95 | 'calendar', |
96 | 96 | 'side', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | add_meta_box( |
103 | 103 | 'simcal-get-shortcode', |
104 | - __( 'Calendar Shortcode', 'google-calendar-events' ), |
|
104 | + __('Calendar Shortcode', 'google-calendar-events'), |
|
105 | 105 | '\SimpleCalendar\Admin\Metaboxes\Get_Shortcode::html', |
106 | 106 | 'calendar', |
107 | 107 | 'side', |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | ); |
110 | 110 | |
111 | 111 | // Add meta box if there are calendars. |
112 | - if ( ( true == simcal_get_calendars() ) && ! empty( $this->post_types ) ) { |
|
113 | - foreach ( $this->post_types as $post_type ) { |
|
112 | + if ((true == simcal_get_calendars()) && ! empty($this->post_types)) { |
|
113 | + foreach ($this->post_types as $post_type) { |
|
114 | 114 | add_meta_box( |
115 | 115 | 'simcal-attach-calendar', |
116 | - __( 'Attach Calendar', 'google-calendar-events' ), |
|
116 | + __('Attach Calendar', 'google-calendar-events'), |
|
117 | 117 | '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::html', |
118 | 118 | $post_type, |
119 | 119 | 'side', |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | - do_action( 'simcal_add_meta_boxes' ); |
|
125 | + do_action('simcal_add_meta_boxes'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | - public function save_meta_boxes( $post_id, $post ) { |
|
138 | + public function save_meta_boxes($post_id, $post) { |
|
139 | 139 | |
140 | 140 | // $post_id and $post are required. |
141 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
141 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Don't save meta boxes for revisions or autosaves. |
146 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
146 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Check the nonce. |
151 | - if ( empty( $_POST['simcal_meta_nonce'] ) || ! wp_verify_nonce( $_POST['simcal_meta_nonce'], 'simcal_save_data' ) ) { |
|
151 | + if (empty($_POST['simcal_meta_nonce']) || ! wp_verify_nonce($_POST['simcal_meta_nonce'], 'simcal_save_data')) { |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
156 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
156 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Check user has permission to edit |
161 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
161 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | self::$saved_meta_boxes = true; |
172 | 172 | |
173 | 173 | // Check the post type. |
174 | - if ( 'calendar' == $post->post_type ) { |
|
175 | - do_action( 'simcal_save_settings_meta', $post_id, $post ); |
|
176 | - } elseif ( in_array( $post->post_type, $this->post_types ) ) { |
|
177 | - do_action( 'simcal_save_attach_calendar_meta', $post_id, $post ); |
|
174 | + if ('calendar' == $post->post_type) { |
|
175 | + do_action('simcal_save_settings_meta', $post_id, $post); |
|
176 | + } elseif (in_array($post->post_type, $this->post_types)) { |
|
177 | + do_action('simcal_save_attach_calendar_meta', $post_id, $post); |
|
178 | 178 | } |
179 | 179 | |
180 | - do_action( 'simcal_save_meta_boxes', $post_id, $post ); |
|
180 | + do_action('simcal_save_meta_boxes', $post_id, $post); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Meta_Box; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -28,38 +28,38 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \WP_Post $post |
30 | 30 | */ |
31 | - public static function html( $post ) { |
|
31 | + public static function html($post) { |
|
32 | 32 | |
33 | 33 | // @see Meta_Boxes::save_meta_boxes() |
34 | - wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' ); |
|
34 | + wp_nonce_field('simcal_save_data', 'simcal_meta_nonce'); |
|
35 | 35 | |
36 | 36 | $calendars = simcal_get_calendars(); |
37 | 37 | |
38 | - simcal_print_field( array( |
|
38 | + simcal_print_field(array( |
|
39 | 39 | 'type' => 'select', |
40 | 40 | 'id' => '_simcal_attach_calendar_id', |
41 | 41 | 'name' => '_simcal_attach_calendar_id', |
42 | - 'enhanced' => count( $calendars ) > 15 ? 'enhanced' : '', |
|
42 | + 'enhanced' => count($calendars) > 15 ? 'enhanced' : '', |
|
43 | 43 | 'allow_void' => 'allow_void', |
44 | - 'value' => absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ), |
|
44 | + 'value' => absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true)), |
|
45 | 45 | 'options' => $calendars, |
46 | 46 | 'attributes' => array( |
47 | 47 | 'data-allowclear' => 'true', |
48 | 48 | ) |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | - $position = get_post_meta( $post->ID, '_simcal_attach_calendar_position', true ); |
|
51 | + $position = get_post_meta($post->ID, '_simcal_attach_calendar_position', true); |
|
52 | 52 | |
53 | - simcal_print_field( array( |
|
53 | + simcal_print_field(array( |
|
54 | 54 | 'type' => 'radio', |
55 | 55 | 'id' => '_simcal_attach_calendar_position', |
56 | 56 | 'name' => '_simcal_attach_calendar_position', |
57 | 57 | 'value' => $position ? $position : 'after', |
58 | 58 | 'options' => array( |
59 | - 'after' => __( 'After content', 'google-calendar-events' ), |
|
60 | - 'before' => __( 'Before content', 'google-calendar-events' ), |
|
59 | + 'after' => __('After content', 'google-calendar-events'), |
|
60 | + 'before' => __('Before content', 'google-calendar-events'), |
|
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * @param int $post_id |
72 | 72 | * @param \WP_Post $post |
73 | 73 | */ |
74 | - public static function save( $post_id, $post ) { |
|
74 | + public static function save($post_id, $post) { |
|
75 | 75 | |
76 | - $id = isset( $_POST['_simcal_attach_calendar_id'] ) ? absint( $_POST['_simcal_attach_calendar_id'] ) : ''; |
|
77 | - update_post_meta( $post_id, '_simcal_attach_calendar_id', $id ); |
|
76 | + $id = isset($_POST['_simcal_attach_calendar_id']) ? absint($_POST['_simcal_attach_calendar_id']) : ''; |
|
77 | + update_post_meta($post_id, '_simcal_attach_calendar_id', $id); |
|
78 | 78 | |
79 | - $position = isset( $_POST['_simcal_attach_calendar_position'] ) ? sanitize_title( $_POST['_simcal_attach_calendar_position'] ) : 'after'; |
|
80 | - update_post_meta( $post_id, '_simcal_attach_calendar_position', $position ); |
|
79 | + $position = isset($_POST['_simcal_attach_calendar_position']) ? sanitize_title($_POST['_simcal_attach_calendar_position']) : 'after'; |
|
80 | + update_post_meta($post_id, '_simcal_attach_calendar_position', $position); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |