@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | namespace SimpleCalendar\Admin; |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param string $post_type |
| 43 | 43 | */ |
| 44 | - public function __construct( $post_type ) { |
|
| 45 | - $this->bulk_action_post_type = post_type_exists( $post_type ) ? $post_type : ''; |
|
| 44 | + public function __construct($post_type) { |
|
| 45 | + $this->bulk_action_post_type = post_type_exists($post_type) ? $post_type : ''; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @param array $args |
| 55 | 55 | */ |
| 56 | - public function register_bulk_action( $args ) { |
|
| 56 | + public function register_bulk_action($args) { |
|
| 57 | 57 | |
| 58 | 58 | $func = array(); |
| 59 | - $func['action_name'] = isset( $args['action_name'] ) ? sanitize_key( $args['action_name'] ) : ''; |
|
| 60 | - $func['callback'] = isset( $args['callback'] ) ? $args['callback'] : ''; |
|
| 61 | - $func['menu_text'] = isset( $args['menu_text'] ) ? esc_attr( $args['menu_text'] ) : ''; |
|
| 62 | - $func['admin_notice'] = isset( $args['admin_notice'] ) ? esc_attr( $args['admin_notice'] ) : ''; |
|
| 59 | + $func['action_name'] = isset($args['action_name']) ? sanitize_key($args['action_name']) : ''; |
|
| 60 | + $func['callback'] = isset($args['callback']) ? $args['callback'] : ''; |
|
| 61 | + $func['menu_text'] = isset($args['menu_text']) ? esc_attr($args['menu_text']) : ''; |
|
| 62 | + $func['admin_notice'] = isset($args['admin_notice']) ? esc_attr($args['admin_notice']) : ''; |
|
| 63 | 63 | |
| 64 | - if ( $func['action_name'] && $func['callback'] ) { |
|
| 65 | - $this->actions[ $func['action_name'] ] = $func; |
|
| 64 | + if ($func['action_name'] && $func['callback']) { |
|
| 65 | + $this->actions[$func['action_name']] = $func; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @since 3.0.0 |
| 75 | 75 | */ |
| 76 | 76 | public function init() { |
| 77 | - if ( is_admin() ) { |
|
| 78 | - add_action( 'admin_footer-edit.php', array( $this, 'custom_bulk_admin_footer' ) ); |
|
| 79 | - add_action( 'load-edit.php', array( $this, 'custom_bulk_action' ) ); |
|
| 80 | - add_action( 'admin_notices', array( $this, 'custom_bulk_admin_notices' ) ); |
|
| 77 | + if (is_admin()) { |
|
| 78 | + add_action('admin_footer-edit.php', array($this, 'custom_bulk_admin_footer')); |
|
| 79 | + add_action('load-edit.php', array($this, 'custom_bulk_action')); |
|
| 80 | + add_action('admin_notices', array($this, 'custom_bulk_admin_notices')); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | global $post_type; |
| 92 | 92 | |
| 93 | 93 | // Only permit actions with defined post type. |
| 94 | - if ( $post_type == $this->bulk_action_post_type ) { |
|
| 94 | + if ($post_type == $this->bulk_action_post_type) { |
|
| 95 | 95 | |
| 96 | 96 | ?> |
| 97 | 97 | <script type="text/javascript"> |
| 98 | 98 | jQuery( document ).ready( function() { |
| 99 | - <?php foreach ( $this->actions as $action_name => $action ) : ?> |
|
| 99 | + <?php foreach ($this->actions as $action_name => $action) : ?> |
|
| 100 | 100 | jQuery( '<option>' ).val( '<?php echo $action_name ?>' ).text( '<?php echo $action['menu_text'] ?>').appendTo( 'select[name="action"]' ); |
| 101 | 101 | jQuery( '<option>' ).val( '<?php echo $action_name ?>' ).text( '<?php echo $action['menu_text'] ?>').appendTo( 'select[name="action2"]' ); |
| 102 | 102 | <?php endforeach; ?> |
@@ -120,65 +120,65 @@ discard block |
||
| 120 | 120 | global $typenow; |
| 121 | 121 | $post_type = $typenow; |
| 122 | 122 | |
| 123 | - if ( $post_type == $this->bulk_action_post_type ) { |
|
| 123 | + if ($post_type == $this->bulk_action_post_type) { |
|
| 124 | 124 | |
| 125 | 125 | // Get the action. |
| 126 | 126 | // Depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc. |
| 127 | - $wp_list_table = _get_list_table( 'WP_Posts_List_Table' ); |
|
| 127 | + $wp_list_table = _get_list_table('WP_Posts_List_Table'); |
|
| 128 | 128 | $action = $wp_list_table->current_action(); |
| 129 | 129 | |
| 130 | 130 | // Allow only defined actions. |
| 131 | - $allowed_actions = array_keys( $this->actions ); |
|
| 132 | - if ( ! in_array( $action, $allowed_actions ) ) { |
|
| 131 | + $allowed_actions = array_keys($this->actions); |
|
| 132 | + if ( ! in_array($action, $allowed_actions)) { |
|
| 133 | 133 | return; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // Security check. |
| 137 | - check_admin_referer( 'bulk-posts' ); |
|
| 137 | + check_admin_referer('bulk-posts'); |
|
| 138 | 138 | |
| 139 | 139 | // Make sure ids are submitted. |
| 140 | 140 | // Depending on the resource type, this may be 'media' or 'ids'. |
| 141 | - if ( isset( $_REQUEST['post'] ) ) { |
|
| 142 | - $post_ids = array_map( 'intval', $_REQUEST['post'] ); |
|
| 141 | + if (isset($_REQUEST['post'])) { |
|
| 142 | + $post_ids = array_map('intval', $_REQUEST['post']); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ( empty( $post_ids ) ) { |
|
| 145 | + if (empty($post_ids)) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // This is based on wp-admin/edit.php. |
| 150 | 150 | $sendback = remove_query_arg( |
| 151 | - array( 'exported', 'untrashed', 'deleted', 'ids' ), |
|
| 151 | + array('exported', 'untrashed', 'deleted', 'ids'), |
|
| 152 | 152 | wp_get_referer() |
| 153 | 153 | ); |
| 154 | - if ( ! $sendback ) { |
|
| 155 | - $sendback = admin_url( "edit.php?post_type=$post_type" ); |
|
| 154 | + if ( ! $sendback) { |
|
| 155 | + $sendback = admin_url("edit.php?post_type=$post_type"); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $pagenum = $wp_list_table->get_pagenum(); |
| 159 | - $sendback = add_query_arg( 'paged', $pagenum, $sendback ); |
|
| 159 | + $sendback = add_query_arg('paged', $pagenum, $sendback); |
|
| 160 | 160 | |
| 161 | 161 | // Check that we have anonymous function as a callback. |
| 162 | - $anon_fns = array_filter( $this->actions[ $action ], function( $el ) { |
|
| 162 | + $anon_fns = array_filter($this->actions[$action], function($el) { |
|
| 163 | 163 | return $el instanceof \Closure; |
| 164 | 164 | } ); |
| 165 | 165 | |
| 166 | - if ( count( $anon_fns ) > 0 ) { |
|
| 167 | - $this->actions[ $action ]['callback']( $post_ids ); |
|
| 166 | + if (count($anon_fns) > 0) { |
|
| 167 | + $this->actions[$action]['callback']($post_ids); |
|
| 168 | 168 | } else { |
| 169 | - call_user_func( $this->actions[ $action ]['callback'], $post_ids ); |
|
| 169 | + call_user_func($this->actions[$action]['callback'], $post_ids); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $sendback = add_query_arg( |
| 173 | - array( 'success_action' => $action, 'ids' => join( ',', $post_ids ) ), |
|
| 173 | + array('success_action' => $action, 'ids' => join(',', $post_ids)), |
|
| 174 | 174 | $sendback |
| 175 | 175 | ); |
| 176 | 176 | $sendback = remove_query_arg( |
| 177 | - array( 'action', 'paged', 'mode', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), |
|
| 177 | + array('action', 'paged', 'mode', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), |
|
| 178 | 178 | $sendback |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | - wp_redirect( $sendback ); |
|
| 181 | + wp_redirect($sendback); |
|
| 182 | 182 | |
| 183 | 183 | exit; |
| 184 | 184 | } |
@@ -193,31 +193,31 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | global $post_type, $pagenow; |
| 195 | 195 | |
| 196 | - if ( isset( $_REQUEST['ids'] ) ) { |
|
| 197 | - $post_ids = explode( ',', $_REQUEST['ids'] ); |
|
| 196 | + if (isset($_REQUEST['ids'])) { |
|
| 197 | + $post_ids = explode(',', $_REQUEST['ids']); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // Make sure ids are submitted. |
| 201 | 201 | // Depending on the resource type, this may be 'media' or 'ids'. |
| 202 | - if ( empty( $post_ids ) ) { |
|
| 202 | + if (empty($post_ids)) { |
|
| 203 | 203 | return; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $post_ids_count = is_array( $post_ids ) ? count( $post_ids ) : 1; |
|
| 206 | + $post_ids_count = is_array($post_ids) ? count($post_ids) : 1; |
|
| 207 | 207 | |
| 208 | - if ( $pagenow == 'edit.php' && $post_type == $this->bulk_action_post_type ) { |
|
| 208 | + if ($pagenow == 'edit.php' && $post_type == $this->bulk_action_post_type) { |
|
| 209 | 209 | |
| 210 | - if ( isset( $_REQUEST['success_action'] ) ) { |
|
| 210 | + if (isset($_REQUEST['success_action'])) { |
|
| 211 | 211 | |
| 212 | 212 | // Print notice in admin bar. |
| 213 | - $message = $this->actions[ $_REQUEST['success_action'] ]['admin_notice']; |
|
| 213 | + $message = $this->actions[$_REQUEST['success_action']]['admin_notice']; |
|
| 214 | 214 | |
| 215 | - if ( is_array( $message ) ) { |
|
| 216 | - $message = sprintf( _n( $message['single'], $message['plural'], $post_ids_count, 'google-calendar-events' ), $post_ids_count ); |
|
| 215 | + if (is_array($message)) { |
|
| 216 | + $message = sprintf(_n($message['single'], $message['plural'], $post_ids_count, 'google-calendar-events'), $post_ids_count); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $class = 'updated notice is-dismissible above-h2'; |
| 220 | - if ( ! empty( $message ) ) { |
|
| 220 | + if ( ! empty($message)) { |
|
| 221 | 221 | echo "<div class=\"{$class}\"><p>{$message}</p></div>"; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | } else { |
| 98 | - // @todo eventually if a date range picker is needed, this can be extended |
|
| 98 | + // @todo eventually if a date range picker is needed, this can be extended |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | ?> |
@@ -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 | |
@@ -45,20 +45,20 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @param array $field |
| 47 | 47 | */ |
| 48 | - public function __construct( $field ) { |
|
| 48 | + public function __construct($field) { |
|
| 49 | 49 | |
| 50 | - $this->range = isset( $field['range'] ) ? ( $field['range'] === true ? true : false ) : false; |
|
| 51 | - $this->inline = isset( $field['inline'] ) ? ( $field['inline'] === true ? true : false ) : true; |
|
| 50 | + $this->range = isset($field['range']) ? ($field['range'] === true ? true : false) : false; |
|
| 51 | + $this->inline = isset($field['inline']) ? ($field['inline'] === true ? true : false) : true; |
|
| 52 | 52 | |
| 53 | 53 | $subtype = $this->range === true ? 'simcal-field-date-picker-range ' : ''; |
| 54 | - $this->type_class = 'simcal-field-date-picker ' . $subtype; |
|
| 54 | + $this->type_class = 'simcal-field-date-picker '.$subtype; |
|
| 55 | 55 | |
| 56 | 56 | $data = array( |
| 57 | 57 | 'data-inline' => $this->inline === true ? 'true' : 'false', |
| 58 | 58 | ); |
| 59 | - $field['attributes'] = isset( $field['attributes'] ) ? array_merge( $field['attributes'], $data ) : $data; |
|
| 59 | + $field['attributes'] = isset($field['attributes']) ? array_merge($field['attributes'], $data) : $data; |
|
| 60 | 60 | |
| 61 | - parent::__construct( $field ); |
|
| 61 | + parent::__construct($field); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -68,18 +68,18 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function html() { |
| 70 | 70 | |
| 71 | - if ( ! empty( $this->description ) ) { |
|
| 72 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
| 71 | + if ( ! empty($this->description)) { |
|
| 72 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | ?> |
| 76 | 76 | <div id="<?php echo $this->id; ?>" |
| 77 | 77 | class="<?php echo $this->class; ?>" |
| 78 | - <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?> |
|
| 78 | + <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?> |
|
| 79 | 79 | <?php echo $this->attributes ?>> |
| 80 | 80 | <?php |
| 81 | 81 | |
| 82 | - if ( false === $this->range ) { |
|
| 82 | + if (false === $this->range) { |
|
| 83 | 83 | |
| 84 | 84 | ?> |
| 85 | 85 | <i class="simcal-icon-calendar"></i> |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | readonly="readonly" /> |
| 91 | 91 | <?php |
| 92 | 92 | |
| 93 | - if ( true === $this->inline ) { |
|
| 93 | + if (true === $this->inline) { |
|
| 94 | 94 | echo $this->tooltip; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -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; ?> |
@@ -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 | |
@@ -51,28 +51,28 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param array $field |
| 53 | 53 | */ |
| 54 | - public function __construct( $field ) { |
|
| 54 | + public function __construct($field) { |
|
| 55 | 55 | |
| 56 | 56 | $class = 'simcal-field-select'; |
| 57 | 57 | |
| 58 | - $enhanced = isset( $field['enhanced'] ) ? $field['enhanced'] : ''; |
|
| 59 | - if ( 'enhanced' == $enhanced ) { |
|
| 58 | + $enhanced = isset($field['enhanced']) ? $field['enhanced'] : ''; |
|
| 59 | + if ('enhanced' == $enhanced) { |
|
| 60 | 60 | $this->enhanced = true; |
| 61 | 61 | $class .= ' simcal-field-select-enhanced'; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $multiselect = isset( $field['multiselect'] ) ? $field['multiselect'] : ''; |
|
| 65 | - if ( 'multiselect' == $multiselect ) { |
|
| 64 | + $multiselect = isset($field['multiselect']) ? $field['multiselect'] : ''; |
|
| 65 | + if ('multiselect' == $multiselect) { |
|
| 66 | 66 | $this->multiselect = true; |
| 67 | 67 | $class .= ' simcal-field-multiselect'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $this->type_class = $class; |
| 71 | 71 | |
| 72 | - $allow_void = isset( $field['allow_void'] ) ? $field['allow_void'] : ''; |
|
| 72 | + $allow_void = isset($field['allow_void']) ? $field['allow_void'] : ''; |
|
| 73 | 73 | $this->allow_void = 'allow_void' == $allow_void ? true : false; |
| 74 | 74 | |
| 75 | - parent::__construct( $field ); |
|
| 75 | + parent::__construct($field); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -82,30 +82,30 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function html() { |
| 84 | 84 | |
| 85 | - if ( $this->multiselect === true && ! is_array( $this->value ) ) { |
|
| 86 | - $this->value = explode( ',', $this->value ); |
|
| 85 | + if ($this->multiselect === true && ! is_array($this->value)) { |
|
| 86 | + $this->value = explode(',', $this->value); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | ?> |
| 90 | - <select name="<?php echo $this->name; ?><?php if ( $this->multiselect === true ) { echo '[]'; } ?>" |
|
| 90 | + <select name="<?php echo $this->name; ?><?php if ($this->multiselect === true) { echo '[]'; } ?>" |
|
| 91 | 91 | id="<?php echo $this->id; ?>" |
| 92 | 92 | style="<?php echo $this->style; ?>" |
| 93 | 93 | class="<?php echo $this->class; ?>" |
| 94 | 94 | <?php echo $this->attributes; ?> |
| 95 | - <?php echo ( $this->multiselect === true ) ? ' multiple="multiple"' : ''; ?>> |
|
| 95 | + <?php echo ($this->multiselect === true) ? ' multiple="multiple"' : ''; ?>> |
|
| 96 | 96 | <?php |
| 97 | 97 | |
| 98 | - if ( $this->allow_void === true ) { |
|
| 99 | - echo '<option value=""' . selected( '', $this->value, false ) . '></option>'; |
|
| 98 | + if ($this->allow_void === true) { |
|
| 99 | + echo '<option value=""'.selected('', $this->value, false).'></option>'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - foreach ( $this->options as $option => $name ) { |
|
| 103 | - if ( is_array( $this->value ) ) { |
|
| 104 | - $selected = selected( in_array( $option, $this->value ), true, false ); |
|
| 102 | + foreach ($this->options as $option => $name) { |
|
| 103 | + if (is_array($this->value)) { |
|
| 104 | + $selected = selected(in_array($option, $this->value), true, false); |
|
| 105 | 105 | } else { |
| 106 | - $selected = selected( $this->value, trim( strval( $option ) ), false ); |
|
| 106 | + $selected = selected($this->value, trim(strval($option)), false); |
|
| 107 | 107 | } |
| 108 | - echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr( $name ) . '</option>'; |
|
| 108 | + echo '<option value="'.$option.'" '.$selected.'>'.esc_attr($name).'</option>'; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | echo $this->tooltip; |
| 116 | 116 | |
| 117 | - if ( ! empty( $this->description ) ) { |
|
| 118 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
| 117 | + if ( ! empty($this->description)) { |
|
| 118 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | } |
@@ -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 | } |