Example #1
0
    $value_second_to = isset($options[$field_name . '_second_to']) ? esc_attr($options[$field_name . '_second_to']) : '17:00';
    echo '<div class="clear opening-hours">';
    echo '<label class="textinput">' . $day . ':</label>';
    echo '<select class="openinghours_from" style="width: 100px;" id="' . $field_name . '_from" name="wpseo_local[' . $field_name . '_from]">';
    echo wpseo_show_hour_options($options['opening_hours_24h'], $value_from);
    echo '</select><span id="' . $field_name . '_to_wrapper"> - ';
    echo '<select class="openinghours_to" style="width: 100px;" id="' . $field_name . '_to" name="wpseo_local[' . $field_name . '_to]">';
    echo wpseo_show_hour_options($options['opening_hours_24h'], $value_to);
    echo '</select>';
    echo '<div class="clear opening-hour-second ' . (empty($options['multiple_opening_hours']) || $options['multiple_opening_hours'] != 'on' ? 'hidden' : '') . '">';
    echo '<label class="textinput">&nbsp;</label>';
    echo '<select class="openinghours_from_second" style="width: 100px;" id="' . $field_name . '_second_from" name="wpseo_local[' . $field_name . '_second_from]">';
    echo wpseo_show_hour_options($options['opening_hours_24h'], $value_second_from);
    echo '</select><span id="' . $field_name . '_second_to_wrapper"> - ';
    echo '<select class="openinghours_to_second" style="width: 100px;" id="' . $field_name . '_second_to" name="wpseo_local[' . $field_name . '_second_to]">';
    echo wpseo_show_hour_options($options['opening_hours_24h'], $value_second_to);
    echo '</select>';
    echo '</div>';
    echo '</div>';
}
echo '</div><!-- #show-opening-hours -->';
echo '</div><!-- #hide-opening-hours -->';
echo '<h2>' . __('Store locator settings', 'yoast-local-seo') . '</h2>';
WPSEO_Local_Admin_Wrappers::textinput('sl_num_results', __('Number of results', 'yoast-local-seo'));
echo '<h2>' . __('Advanced settings', 'yoast-local-seo') . '</h2>';
WPSEO_Local_Admin_Wrappers::textinput('api_key', __('Google Maps API key<br>(not required)', 'yoast-local-seo'));
echo '<p class="desc label" style="border:none; margin-bottom: 0;">' . sprintf(__('When you have a lot of locations, you could hit the limits of the Geocoding API. In that case you can enter your Google Maps API key to prevent that. To obtain an API key, please read more about it at the %sGoogle Maps documentation%s (make sure the Geocoding API is enabled in the Services section).', 'yoast-local-seo'), '<a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key">', '</a>') . '</p>';
WPSEO_Local_Admin_Wrappers::select('unit_system', __('Unit System', 'yoast-local-seo'), array('METRIC' => __('Metric', 'yoast-local-seo'), 'IMPERIAL' => __('Imperial', 'yoast-local-seo')));
WPSEO_Local_Admin_Wrappers::select('map_view_style', __('Default map style', 'yoast-local-seo'), array('HYBRID' => __('Hybrid', 'yoast-local-seo'), 'SATELLITE' => __('Satellite', 'yoast-local-seo'), 'ROADMAP' => __('Roadmap', 'yoast-local-seo'), 'TERRAIN' => __('Terrain', 'yoast-local-seo')));
WPSEO_Local_Admin_Wrappers::select('address_format', __('Address format', 'yoast-local-seo'), array('address-state-postal' => '{address} {city}, {state} {zipcode} &nbsp;&nbsp;&nbsp;&nbsp; (New York, NY 12345 )', 'address-state-postal-comma' => '{address} {city}, {state}, {zipcode} &nbsp;&nbsp;&nbsp;&nbsp; (New York, NY, 12345 )', 'address-postal-city-state' => '{address} {zipcode} {city}, {state} &nbsp;&nbsp;&nbsp;&nbsp; (12345 New York, NY )', 'address-postal' => '{address} {city} {zipcode} &nbsp;&nbsp;&nbsp;&nbsp; (New York 12345 )', 'address-postal-comma' => '{address} {city}, {zipcode} &nbsp;&nbsp;&nbsp;&nbsp; (New York, 12345 )', 'address-city' => '{address} {city} &nbsp;&nbsp;&nbsp;&nbsp; (London)', 'postal-address' => '{zipcode} {state} {city} {address} &nbsp;&nbsp;&nbsp;&nbsp; (12345, NY, New York)'));
echo '<p class="desc label" style="border:none; margin-bottom: 0;">' . sprintf(__('A lot of countries have their own address format. Please choose one that matches yours. If you have something completely different, please let us know via %s.', 'yoast-local-seo'), '<a href="mailto:pluginsupport@yoast.com">pluginsupport@yoast.com</a>') . '</p>';
Example #2
0
 /**
  * Builds the metabox for editing screen of the wpseo_locations Custom Post Type
  */
 function metabox_locations()
 {
     /** @var WPSEO_Local_Core */
     global $wpseo_local_core;
     $post_id = get_the_ID();
     echo '<div style="overflow: hidden;" id="wpseo-local-metabox">';
     // Noncename needed to verify where the data originated
     echo '<input type="hidden" name="locationsmeta_noncename" id="locationsmeta_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
     // Copy from other locations field
     $locations = get_posts(array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'fields' => 'ids', 'exclude' => $post_id));
     if (count($locations) > 0) {
         echo '<p>';
         echo '<label class="textinput">' . __('Copy data from another location', 'yoast-local-seo') . ':</label>';
         echo '<select class="chzn-select" name="_wpseo_copy_from_location" id="wpseo_copy_from_location" style="width: 400px;" data-placeholder="' . __('Choose your location', 'yoast-local-seo') . '">';
         echo '<option value=""></option>';
         foreach ($locations as $location_id) {
             echo '<option value="' . $location_id . '">' . get_the_title($location_id) . '</option>';
         }
         echo '</select>';
         echo '</p>';
         echo '<p style="clear:both; margin-left: 150px;"><em><strong>' . __('Note', 'yoast-local-seo') . ':</strong> ' . __('selecting a location will overwrite all data below. If you accidently selected a location, just refresh the page and make sure you don\'t save it.', 'yoast-local-seo') . '</em></p><br>';
         wp_reset_postdata();
     }
     // Get the location data if its already been entered
     $business_type = get_post_meta($post_id, '_wpseo_business_type', true);
     $business_address = get_post_meta($post_id, '_wpseo_business_address', true);
     $business_city = get_post_meta($post_id, '_wpseo_business_city', true);
     $business_state = get_post_meta($post_id, '_wpseo_business_state', true);
     $business_zipcode = get_post_meta($post_id, '_wpseo_business_zipcode', true);
     $business_country = get_post_meta($post_id, '_wpseo_business_country', true);
     $business_phone = get_post_meta($post_id, '_wpseo_business_phone', true);
     $business_phone_2nd = get_post_meta($post_id, '_wpseo_business_phone_2nd', true);
     $business_fax = get_post_meta($post_id, '_wpseo_business_fax', true);
     $business_email = get_post_meta($post_id, '_wpseo_business_email', true);
     $notes_1 = get_post_meta($post_id, '_wpseo_business_notes_1', true);
     $notes_2 = get_post_meta($post_id, '_wpseo_business_notes_2', true);
     $notes_3 = get_post_meta($post_id, '_wpseo_business_notes_3', true);
     $business_url = get_post_meta($post_id, '_wpseo_business_url', true);
     $business_vat_id = get_post_meta($post_id, '_wpseo_business_vat_id', true);
     $business_tax_id = get_post_meta($post_id, '_wpseo_business_tax_id', true);
     $business_coc_id = get_post_meta($post_id, '_wpseo_business_coc_id', true);
     $coordinates_lat = get_post_meta($post_id, '_wpseo_coordinates_lat', true);
     $coordinates_long = get_post_meta($post_id, '_wpseo_coordinates_long', true);
     $is_postal_address = get_post_meta($post_id, '_wpseo_is_postal_address', true);
     $multiple_opening_hours = get_post_meta($post_id, '_wpseo_multiple_opening_hours', true);
     $multiple_opening_hours = $multiple_opening_hours == 'on';
     // Echo out the field
     echo '<p><label class="textinput" for="wpseo_business_type">Business type:</label>';
     echo '<select class="chzn-select" name="_wpseo_business_type" id="wpseo_business_type" style="width: 200px;" data-placeholder="' . __('Choose your business type', 'yoast-local-seo') . '">';
     echo '<option></option>';
     foreach ($wpseo_local_core->get_local_business_types() as $bt_option => $bt_label) {
         echo '<option ' . selected($business_type, $bt_option, false) . ' value="' . $bt_option . '">' . $bt_label . '</option>';
     }
     echo '</select></p>';
     echo '<p class="desc label">' . sprintf(__('If your business type is not listed, please read %sthe FAQ entry%s.', 'yoast-local-seo'), '<a href="http://kb.yoast.com/article/49-my-business-is-not-listed-can-you-add-it" target="_blank">', '</a>') . '</p><br class="clear">';
     echo '<p><label class="textinput" for="wpseo_business_address">' . __('Business address:', 'yoast-local-seo') . '</label>';
     echo '<input type="text" name="_wpseo_business_address" id="wpseo_business_address" value="' . $business_address . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_city">' . __('Business city', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_city" id="wpseo_business_city" value="' . $business_city . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_state">' . __('Business state', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_state" id="wpseo_business_state" value="' . $business_state . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_zipcode">' . __('Business zipcode', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_zipcode" id="wpseo_business_zipcode" value="' . $business_zipcode . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_country">' . __('Business country', 'yoast-local-seo') . ':</label>';
     echo '<select class="chzn-select" name="_wpseo_business_country" id="wpseo_business_country" style="width: 200px; margin-top: 8px;" data-placeholder="' . __('Choose your country', 'yoast-local-seo') . '">';
     echo '<option></option>';
     $countries = WPSEO_Local_Frontend::get_country_array();
     foreach ($countries as $key => $val) {
         echo '<option value="' . $key . '"' . ($business_country == $key ? ' selected="selected"' : '') . '>' . $countries[$key] . '</option>';
     }
     echo '</select></p>';
     echo '<p><label class="textinput" for="wpseo_business_phone">' . __('Main phone number', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_phone" id="wpseo_business_phone" value="' . $business_phone . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_phone_2nd">' . __('Second phone number', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_phone_2nd" id="wpseo_business_phone_2nd" value="' . $business_phone_2nd . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_fax">' . __('Fax number', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_fax" id="wpseo_business_fax" value="' . $business_fax . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_email">' . __('Email address', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_email" id="wpseo_business_email" value="' . $business_email . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_url">' . __('URL', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_url" id="wpseo_business_url" value="' . $business_url . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_vat_id">' . __('VAT ID', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_vat_id" id="wpseo_business_vat_id" value="' . $business_vat_id . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_tax_id">' . __('Tax ID', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_tax_id" id="wpseo_business_tax_id" value="' . $business_tax_id . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_business_coc_id">' . __('Chamber of Commerce ID', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_business_coc_id" id="wpseo_business_coc_id" value="' . $business_coc_id . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_custom_notes_1">' . __('Notes', 'yoast-local-seo') . ':</label>';
     echo '<textarea name="_wpseo_business_notes_1" id="wpseo_business_notes_1" >' . $notes_1 . '</textarea></p>';
     echo '<p><label class="textinput" for="wpseo_business_notes_2">' . __('Notes', 'yoast-local-seo') . ':</label>';
     echo '<textarea name="_wpseo_business_notes_2" id="wpseo_business_notes_2" >' . $notes_2 . '</textarea></p>';
     echo '<p><label class="textinput" for="wpseo_business_notes_3">' . __('Notes', 'yoast-local-seo') . ':</label>';
     echo '<textarea name="_wpseo_business_notes_3" id="wpseo_business_notes_3" >' . $notes_3 . '</textarea></p>';
     echo '<p>' . __('You can enter the lat/long coordinates yourself. If you leave them empty they will be calculated automatically. If you want to re-calculate these fields, please make them blank before saving this location.', 'yoast-local-seo') . '</p>';
     echo '<p><label class="textinput" for="wpseo_coordinates_lat">' . __('Latitude', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_coordinates_lat" id="wpseo_coordinates_lat" value="' . $coordinates_lat . '" /></p>';
     echo '<p><label class="textinput" for="wpseo_coordinates_long">' . __('Longitude', 'yoast-local-seo') . ':</label>';
     echo '<input type="text" name="_wpseo_coordinates_long" id="wpseo_coordinates_long" value="' . $coordinates_long . '" /></p>';
     echo '<p>' . __('If the marker is not in the right location for your store, you can drag the pin to the location where you want it.', 'yoast-local-seo') . '</p>';
     wpseo_local_show_map(array('id' => $post_id, 'echo' => true, 'show_route' => false, 'map_style' => 'roadmap', 'draggable' => true));
     echo '<p>';
     echo '<label class="textinput" for="wpseo_is_postal_address">' . __('This address is a postal address (not a physical location)', 'yoast-local-seo') . ':</label>';
     echo '<input type="checkbox" class="checkbox" name="_wpseo_is_postal_address" id="wpseo_is_postal_address" value="1" ' . checked($is_postal_address, 1, false) . ' />';
     echo '</p>';
     $hide_opening_hours = isset($this->options['hide_opening_hours']) && $this->options['hide_opening_hours'] == 'on';
     // Opening hours
     echo '<br class="clear">';
     echo '<div id="hide-opening-hours" style="display: ' . ($hide_opening_hours ? 'none' : 'block') . ';">';
     echo '<h4>' . __('Opening hours', 'yoast-local-seo') . '</h4>';
     echo '<div id="opening-hours-multiple">';
     echo '<label for="wpseo_multiple_opening_hours" class="textinput">' . __('I have two sets of opening hours per day', 'yoast-local-seo') . ':</label>';
     echo '<input class="checkbox" id="wpseo_multiple_opening_hours" type="checkbox" name="_wpseo_multiple_opening_hours" value="on" ' . checked(true, $multiple_opening_hours, false) . '> ';
     echo '</div>';
     echo '<br class="clear">';
     foreach ($wpseo_local_core->days as $key => $day) {
         $field_name = '_wpseo_opening_hours_' . $key;
         $value_from = get_post_meta($post_id, $field_name . '_from', true);
         if (!$value_from) {
             $value_from = '09:00';
         }
         $value_to = get_post_meta($post_id, $field_name . '_to', true);
         if (!$value_to) {
             $value_to = '17:00';
         }
         $value_second_from = get_post_meta($post_id, $field_name . '_second_from', true);
         if (!$value_second_from) {
             $value_second_from = '09:00';
         }
         $value_second_to = get_post_meta($post_id, $field_name . '_second_to', true);
         if (!$value_second_to) {
             $value_second_to = '17:00';
         }
         echo '<div class="clear opening-hours">';
         if (!isset($this->options['opening_hours_24h'])) {
             $this->options['opening_hours_24h'] = false;
         }
         echo '<label class="textinput">' . $day . ':</label>';
         echo '<select class="openinghours_from" style="width: 100px;" id="' . $field_name . '_from" name="' . $field_name . '_from">';
         echo wpseo_show_hour_options($this->options['opening_hours_24h'], $value_from);
         echo '</select><span id="' . $field_name . '_to_wrapper"> - ';
         echo '<select class="openinghours_to" style="width: 100px;" id="' . $field_name . '_to" name="' . $field_name . '_to">';
         echo wpseo_show_hour_options($this->options['opening_hours_24h'], $value_to);
         echo '</select></span>';
         echo '<div class="clear opening-hour-second ' . (!$multiple_opening_hours ? 'hidden' : '') . '">';
         echo '<div id="' . $field_name . '_second">';
         echo '<label class="textinput">&nbsp;</label>';
         echo '<select class="openinghours_from_second" style="width: 100px;" id="' . $field_name . '_second_from" name="' . $field_name . '_second_from">';
         echo wpseo_show_hour_options($this->options['opening_hours_24h'], $value_second_from);
         echo '</select><span id="' . $field_name . '_second_to_wrapper"> - ';
         echo '<select class="openinghours_to_second" style="width: 100px;" id="' . $field_name . '_second_to" name="' . $field_name . '_second_to">';
         echo wpseo_show_hour_options($this->options['opening_hours_24h'], $value_second_to);
         echo '</select></span>';
         echo '</div>';
         echo '</div>';
         echo '</div>';
     }
     echo '</div><!-- #hide-opening-hours -->';
     echo '<br class="clear" />';
     echo '</div>';
 }