Skip to content

Commit

Permalink
width can be set independant from height in eme_location_map
Browse files Browse the repository at this point in the history
  • Loading branch information
liedekef committed Jan 14, 2025
1 parent 5a7c64e commit 0438881
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 92 deletions.
4 changes: 4 additions & 0 deletions css/eme.css
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ div.dt-length select.dt-input {
.leaflet-container a.leaflet-popup-close-button {
box-shadow: none;
}
/* leaflet prevent a-link underline for zoom in/out */
.leaflet-control-zoom-in, .leaflet-control-zoom-out {
text-decoration: none !important;
}

.eme_required {
border: 2px solid red !important;
Expand Down
59 changes: 29 additions & 30 deletions eme-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -6515,39 +6515,38 @@ function eme_event_form( $event, $info, $edit_recurrence = 0 ) {
?>
</div>

<p class="submit">
<?php if ( $is_new_event ) { ?>
<input type="submit" class="button-primary" id="event_update_button" name="event_update_button" value="<?php esc_attr_e( 'Save', 'events-made-easy' ); ?> &raquo;">
<br><?php esc_html_e( 'If pressing save or update does not seem to be doing anything, then check all other tabs to make sure all required fields are filled out.', 'events-made-easy' ); ?>
<p class="submit">
<?php if ( $is_new_event ) { ?>
<input type="submit" class="button-primary" id="event_update_button" name="event_update_button" value="<?php esc_attr_e( 'Save', 'events-made-easy' ); ?> &raquo;">
<br><?php esc_html_e( 'If pressing Save does not seem to be doing anything, then check all other tabs to make sure all required fields are filled out.', 'events-made-easy' ); ?>
<?php
} else {
$delete_button_text = esc_html__( 'Are you sure you want to delete this event?', 'events-made-easy' );
$deleteRecurrence_button_text = esc_html__( 'Are you sure you want to delete this recurrence?', 'events-made-easy' );
?>
<input type="submit" class="button-primary" id="event_update_button" name="event_update_button" value="<?php esc_attr_e( 'Update', 'events-made-easy' ); ?> &raquo;">
<?php if ( ! $edit_recurrence ) { ?>
<input type="submit" class="button-primary" id="event_delete_button" name="event_delete_button" value="<?php esc_attr_e( 'Delete Event', 'events-made-easy' ); ?> &raquo;" onclick="return areyousure('<?php echo $delete_button_text; ?>');">
<?php
} else {
$delete_button_text = esc_html__( 'Are you sure you want to delete this event?', 'events-made-easy' );
$deleteRecurrence_button_text = esc_html__( 'Are you sure you want to delete this recurrence?', 'events-made-easy' );
$view_button_text = __( 'View', 'events-made-easy' );
$view_button = sprintf(
'%s<span class="screen-reader-text"> %s</span> &raquo;',
$view_button_text,
/* translators: Accessibility text. */
__( '(opens in a new tab)', 'events-made-easy' )
);
?>
<input type="submit" class="button-primary" id="event_update_button" name="event_update_button" value="<?php esc_attr_e( 'Update', 'events-made-easy' ); ?> &raquo;">
<?php if ( ! $edit_recurrence ) { ?>
<input type="submit" class="button-primary" id="event_delete_button" name="event_delete_button" value="<?php esc_attr_e( 'Delete Event', 'events-made-easy' ); ?> &raquo;" onclick="return areyousure('<?php echo $delete_button_text; ?>');">
<?php
$view_button_text = __( 'View', 'events-made-easy' );
$view_button = sprintf(
'%s<span class="screen-reader-text"> %s</span> &raquo;',
$view_button_text,
/* translators: Accessibility text. */
__( '(opens in a new tab)', 'events-made-easy' )
);
?>
<a class="button-primary" href="<?php echo eme_event_url( $event ); ?>" target="wp-view-<?php echo intval($event['event_id']); ?>" id="event-view"><?php echo $view_button; ?></a>

<br><?php esc_html_e( 'If pressing save or update does not seem to be doing anything, then check all other tabs to make sure all required fields are filled out.', 'events-made-easy' ); ?>
<a class="button-primary" href="<?php echo eme_event_url( $event ); ?>" target="wp-view-<?php echo intval($event['event_id']); ?>" id="event-view"><?php echo $view_button; ?></a>
<br><?php esc_html_e( 'If pressing Update does not seem to be doing anything, then check all other tabs to make sure all required fields are filled out.', 'events-made-easy' ); ?>
<?php } ?>
<?php if ( $edit_recurrence && $recurrence_id > 0 ) { ?>
<input type="submit" class="button-primary" id="event_deleteRecurrence_button" name="event_deleteRecurrence_button" value="<?php esc_attr_e( 'Delete Recurrence', 'events-made-easy' ); ?> &raquo;" onclick="return areyousure('<?php echo $deleteRecurrence_button_text; ?>');">
<?php if ( $edit_recurrence && $recurrence_id > 0 ) { ?>
<input type="submit" class="button-primary" id="event_deleteRecurrence_button" name="event_deleteRecurrence_button" value="<?php esc_attr_e( 'Delete Recurrence', 'events-made-easy' ); ?> &raquo;" onclick="return areyousure('<?php echo $deleteRecurrence_button_text; ?>');">
<?php } ?>
<?php } ?>
</p>
</div>
<!-- END OF MAIN -->
<!-- SIDEBAR -->
<?php } ?>
</p>
</div>
<!-- END OF MAIN -->
<!-- SIDEBAR -->
<div id="postbox-container-1" class="postbox-container">
<div id='side-sortables' class="meta-box-sortables ui-sortable">
<?php if ( current_user_can( get_option( 'eme_cap_author_event' ) ) || current_user_can( get_option( 'eme_cap_edit_events' ) ) ) { ?>
Expand Down Expand Up @@ -8640,7 +8639,7 @@ function eme_meta_box_div_event_payment_methods( $event, $is_new_event ) {
esc_html_e( 'No payment methods configured yet. Go in the EME payment settings and configure some.', 'events-made-easy' );
echo "</b>";
} else {
echo eme_ui_multiselect( $event['event_properties']['payment_gateways'], 'eme_prop_payment_gateways', $configured_pgs_descriptions, 5, '', 0, 'eme_select2_width50_class' );
echo eme_ui_multiselect( $event['event_properties']['payment_gateways'], 'eme_prop_payment_gateways', $configured_pgs_descriptions, 5, '', 0, 'eme_select2_width50_class', 'data-placeholder="'.__('Select a payment method','events-made-easy') .'"' );
}
?>
</p>
Expand Down
138 changes: 76 additions & 62 deletions eme-locations.php
Original file line number Diff line number Diff line change
Expand Up @@ -1644,14 +1644,22 @@ function eme_global_map_shortcode( $atts ) {
$id_base = preg_replace( '/\D/', '_', microtime( 1 ) );
$id_base = rand() . '_' . $id_base;
$style = '';
if ( ! empty( $width ) && ! empty( $height ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $width ) ) {
$width = $width . 'px';
if ( ! empty( $width ) || ! empty( $height ) ) {
$width_style = '';
if (! empty( $width ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $width ) ) {
$width = $width . 'px';
}
$width_style = "width: $width;";
}
if ( ! preg_match( '/\%$|px$|fr$|em$/', $height ) ) {
$height = $height . 'px';
$height_style = '';
if (! empty( $height ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $height ) ) {
$height = $height . 'px';
}
$height_style = "height: $height;";
}
$style = "style='width: $width; height: $height'";
$style = "style='$width_style $height_style'";
}

$result = '';
Expand All @@ -1662,64 +1670,63 @@ function eme_global_map_shortcode( $atts ) {
$result .= "<script type='text/javascript'>
$locations_string = $locations_val;
</script>";
}
}

if ( $atts['paging'] == 1 ) {
$pagination_top = "<div id='div_locations-pagination-top_$id_base' class='locations-pagination-top'> ";
$this_page_url = get_permalink($post->ID);
if ( $prev_text != '' ) {
$pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg( [ 'eme_offset' => $prev_offset ], $this_page_url ) . "'>&lt;&lt; $prev_text</a>";
}
if ( $next_text != '' ) {
$pagination_top .= "<a class='eme_nav_right' href='" . add_query_arg( [ 'eme_offset' => $next_offset ], $this_page_url ) . "'>$next_text &gt;&gt;</a>";
}
$pagination_top .= "<span class='eme_nav_center'>$scope_text</span>";
$pagination_top .= '</div>';
$pagination_bottom = str_replace( 'locations-pagination-top', 'locations-pagination-bottom', $pagination_top );
$result = $pagination_top . $result . $pagination_bottom;
if ( $atts['paging'] == 1 ) {
$pagination_top = "<div id='div_locations-pagination-top_$id_base' class='locations-pagination-top'> ";
$this_page_url = get_permalink($post->ID);
if ( $prev_text != '' ) {
$pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg( [ 'eme_offset' => $prev_offset ], $this_page_url ) . "'>&lt;&lt; $prev_text</a>";
}

$loc_list = "<div id='eme_div_locations_list_$id_base' class='eme_div_locations_list'><ol id='eme_locations_list_$id_base' class='eme_locations_list'>";
if ( $letter_icons ) {
$letter_style = "style='list-style-type: upper-alpha'";
$firstletter = 'A';
} else {
$letter_style = '';
$firstletter = '';
if ( $next_text != '' ) {
$pagination_top .= "<a class='eme_nav_right' href='" . add_query_arg( [ 'eme_offset' => $next_offset ], $this_page_url ) . "'>$next_text &gt;&gt;</a>";
}
foreach ( $locations as $location ) {
if ( $show_locations ) {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
$pagination_top .= "<span class='eme_nav_center'>$scope_text</span>";
$pagination_top .= '</div>';
$pagination_bottom = str_replace( 'locations-pagination-top', 'locations-pagination-bottom', $pagination_top );
$result = $pagination_top . $result . $pagination_bottom;
}

$loc_list = "<div id='eme_div_locations_list_$id_base' class='eme_div_locations_list'><ol id='eme_locations_list_$id_base' class='eme_locations_list'>";
if ( $letter_icons ) {
$letter_style = "style='list-style-type: upper-alpha'";
$firstletter = 'A';
} else {
$letter_style = '';
$firstletter = '';
}
foreach ( $locations as $location ) {
if ( $show_locations ) {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
"' $letter_style><a>" .
eme_trans_esc_html( $location['location_name'] ) . '</a></li>';
}
if ( $show_events ) {
$events = eme_get_events( scope: $scope, offset: $scope_offset, location_id: $location['location_id'], category: $atts['category'] );
$loc_list .= "<ol id='eme_events_list'>";
foreach ( $events as $event ) {
if ( $show_locations ) {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
"' style='list-style-type: none'>- <a>" .
eme_trans_esc_html( $event['event_name'] ) . '</a></li>';
} else {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
"' style='list-style-type: none'>$firstletter. <a>" .
eme_trans_esc_html( $event['event_name'] ) . '</a></li>';
}
}
if ( $show_events ) {
$events = eme_get_events( scope: $scope, offset: $scope_offset, location_id: $location['location_id'], category: $atts['category'] );
$loc_list .= "<ol id='eme_events_list'>";
foreach ( $events as $event ) {
if ( $show_locations ) {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
"' style='list-style-type: none'>- <a>" .
eme_trans_esc_html( $event['event_name'] ) . '</a></li>';
} else {
$loc_list .= "<li id='location-" . $location['location_id'] . "_$id_base" .
"' style='list-style-type: none'>$firstletter. <a>" .
eme_trans_esc_html( $event['event_name'] ) . '</a></li>';
}
$loc_list .= '</ol>';
}
if ( $letter_icons ) {
++$firstletter;
}
$loc_list .= '</ol>';
}
$loc_list .= '</ol></div>';
if ( $atts['list_location'] == 'before' ) {
$result = $loc_list . $result;
} elseif ( $atts['list_location'] == 'after' ) {
$result .= $loc_list;
if ( $letter_icons ) {
++$firstletter;
}
}
$loc_list .= '</ol></div>';
if ( $atts['list_location'] == 'before' ) {
$result = $loc_list . $result;
} elseif ( $atts['list_location'] == 'after' ) {
$result .= $loc_list;
}
return $result;
}

Expand Down Expand Up @@ -2762,16 +2769,23 @@ function eme_single_location_map( $location, $width = 0, $height = 0, $zoom_fact
$zoom_factor = 14;
}
//$map_div = "<div id='$id' style=' background: green; width: 400px; height: 300px'></div>" ;
if ( ! empty( $width ) && ! empty( $height ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $width ) ) {
$width = $width . 'px';
$style = '';
if ( ! empty( $width ) || ! empty( $height ) ) {
$width_style = '';
if (! empty( $width ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $width ) ) {
$width = $width . 'px';
}
$width_style = "width: $width;";
}
if ( ! preg_match( '/\%$|px$|fr$|em$/', $height ) ) {
$height = $height . 'px';
$height_style = '';
if (! empty( $height ) ) {
if ( ! preg_match( '/\%$|px$|fr$|em$/', $height ) ) {
$height = $height . 'px';
}
$height_style = "height: $height;";
}
$style = "style='width: $width; height: $height'";
} else {
$style = '';
$style = "style='$width_style $height_style'";
}
$data = "data-lat='" . $location['location_latitude'] . "'";
$data .= " data-lon='" . $location['location_longitude'] . "'";
Expand Down

0 comments on commit 0438881

Please sign in to comment.