예제 #1
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     add_action('admin_init', array($this, 'options_init'));
     // Adds page to WP SEO menu
     add_action('wpseo_submenu_pages', array($this, 'register_settings_page'), 20);
     // Register local into admin_pages
     add_action('init', array($this, 'register_wpseo'));
     // Add import options for Local SEO to general import panel of WP SEO
     if (wpseo_has_multiple_locations()) {
         if (version_compare(WPSEO_VERSION, '2', '>=')) {
             add_action('wpseo_import_tab_header', array($this, 'create_import_tab_header'));
             add_action('wpseo_import_tab_content', array($this, 'create_import_tab_content'));
         } else {
             add_action('wpseo_import', array($this, 'import_panel'), 10, 1);
         }
     }
     // Add styles and scripts
     add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
     add_action('admin_print_styles', array($this, 'config_page_styles'));
     add_action('admin_footer', array($this, 'config_page_footer'));
     // Flush the rewrite rules after options change
     add_action('update_option_wpseo_local', array($this, 'update_multiple_locations'), 10, 2);
     add_action('admin_init', array($this, 'flush_rewrite_rules'));
 }
예제 #2
0
파일: local.php 프로젝트: scottnkerr/eeco
echo '</p>';
WPSEO_Local_Admin_Wrappers::textinput('locations_label_plural', __('Locations label plural', 'yoast-local-seo'));
echo '<p class="desc label" style="border: 0; margin-bottom: 0; padding-bottom: 0;">' . __('The plural label for your location pages. Default label is <code>Locations</code>.', 'yoast-local-seo') . '<br>';
echo '</p>';
WPSEO_Local_Admin_Wrappers::textinput('locations_taxo_slug', __('Locations category slug', 'yoast-local-seo'));
echo '<p class="desc label" style="border: 0; margin-bottom: 0; padding-bottom: 0;">' . __('The slug for your location categories. Default slug is <code>locations-category</code>.', 'yoast-local-seo') . '<br>';
echo '<a href="' . admin_url('edit-tags.php?taxonomy=wpseo_locations_category&post_type=wpseo_locations') . '">' . __('Edit the categories', 'yoast-local-seo') . '</a>';
echo '</p>';
echo '</div><!-- #show-multiple-locations -->';
echo '<h2>' . __('Opening hours', 'yoast-local-seo') . '</h2>';
WPSEO_Local_Admin_Wrappers::checkbox('hide_opening_hours', '', __('Hide opening hours option', 'yoast-local-seo'));
$hide_opening_hours = isset($options['hide_opening_hours']) && $options['hide_opening_hours'] == 'on';
echo '<div id="hide-opening-hours" style="clear: both; display:' . ($hide_opening_hours ? 'none' : 'block') . ';">';
WPSEO_Local_Admin_Wrappers::checkbox('opening_hours_24h', '', __('Use 24h format', 'yoast-local-seo'));
echo '<br class="clear">';
echo '<div id="show-opening-hours" ' . (wpseo_has_multiple_locations() ? ' class="hidden"' : '') . '>';
echo '<div id="opening-hours-multiple">';
WPSEO_Local_Admin_Wrappers::checkbox('multiple_opening_hours', '', __('I have two sets of opening hours per day', 'yoast-local-seo'));
echo '</div>';
echo '<br class="clear">';
if (!isset($options['opening_hours_24h'])) {
    $options['opening_hours_24h'] = false;
}
foreach ($wpseo_local_core->days as $key => $day) {
    $field_name = 'opening_hours_' . $key;
    $value_from = isset($options[$field_name . '_from']) ? esc_attr($options[$field_name . '_from']) : '09:00';
    $value_to = isset($options[$field_name . '_to']) ? esc_attr($options[$field_name . '_to']) : '17:00';
    $value_second_from = isset($options[$field_name . '_second_from']) ? esc_attr($options[$field_name . '_second_from']) : '09:00';
    $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>';
예제 #3
0
        function add_mce_popup()
        {
            $is_post_edit_page = in_array(basename($_SERVER['PHP_SELF']), array('post.php', 'page.php', 'page-new.php', 'post-new.php'));
            if (!$is_post_edit_page) {
                return;
            }
            if (!post_type_supports(get_post_type(), 'editor')) {
                return;
            }
            ?>

		    <script>
			    function WPSEO_InsertMap() {
			    	var wrapper = jQuery('#wpseo_add_map');
			    	var location_id = jQuery("#wpseo_map_location_id").val();
			        var term_id = jQuery("#wpseo_map_term_id").val();
				    var center_id = jQuery("#wpseo_map_center_location_id").val();

			    	<?php 
            if (wpseo_has_multiple_locations()) {
                ?>
				        if( location_id == '' ) {
				            alert("<?php 
                _e('Please select a location', 'yoast-local-seo');
                ?>
");
				            return;
				        }

				        if( location_id != 'all' && term_id != '' ) {
				            alert("<?php 
                _e('If you want to use a category, please set location to \'all\'', 'yoast-local-seo');
                ?>
");
				            return;
				        }

				        if( location_id != 'all' && center_id != '' ) {
					        alert("<?php 
                _e('If you select a single location , please set location to \'all\'', 'yoast-local-seo');
                ?>
");
					        return;
				        }
			        <?php 
            }
            ?>

			        var map_style = jQuery('input[name=wpseo_map_style]:checked', '.wpseo_map_style').val()
			        var width = jQuery("#wpseo_map_width").val();
			        var height = jQuery("#wpseo_map_height").val();
			        var zoom = jQuery("#wpseo_map_zoom").val();
			        var scrollable = jQuery("#wpseo_map_scrollable").is(":checked") ? ' scrollable="1"' : ' scrollable="0"';
				    var draggable = jQuery("#wpseo_map_draggable").is(":checked") ? ' draggable="1"' : ' draggable="0"';
			        var show_route = jQuery("#wpseo_map_show_route").is(":checked") ? ' show_route="1"' : ' show_route="0"';
			        var show_state = jQuery("#wpseo_map_show_state").is(":checked") ? ' show_state="1"' : ' show_state="0"';
			        var show_country = jQuery("#wpseo_map_show_country").is(":checked") ? ' show_country="1"' : '';
			        var show_url = jQuery("#wpseo_map_show_url").is(":checked") ? ' show_url="1"' : '';
			        var show_email = jQuery("#wpseo_map_show_email").is(":checked") ? ' show_email="1"' : '';

			        var id = '';
			        if( location_id != 'undefined' && typeof location_id != 'undefined' ) {
			        	id = "id=\"" + location_id + "\" ";
			        }

			        var term = '';
			        if( term_id != 'undefined' && typeof term_id != 'undefined' && term_id != '' ) {
			        	term = "term_id=\"" + term_id + "\" ";
			        }

				    var center = ''
				    if( center_id != 'undefined' && typeof center_id != 'undefined' && center_id != '' ) {
					    center = "center=\"" + center_id + "\" ";
				    }

			        window.send_to_editor("[wpseo_map " + id + term + center + " width=\"" + width + "\" height=\"" + height + "\" zoom=\"" + zoom + "\" map_style=\"" + map_style + "\"" + scrollable + draggable + show_route + show_state + show_country + show_url + "]");
			    }
		        function WPSEO_InsertAddress() {
		            var location_id = jQuery("#wpseo_address_location_id").val();
		            var term_id = jQuery("#wpseo_address_term_id").val();

		            <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
			            if( location_id == '' ) {
			                alert("<?php 
                _e('Please select a location', 'yoast-local-seo');
                ?>
");
			                return;
			            }

				        if( location_id != 'all' && term_id != '' && jQuery("#wpseo_address_term_id").length ) {
				            alert("<?php 
                _e('If you want to use a category, please set location to \'all\'', 'yoast-local-seo');
                ?>
");
				            return;
				        }
			        <?php 
            }
            ?>

		            var hide_name = jQuery("#wpseo_hide_name").is(":checked") ? ' hide_name="1"' : '';
		            var oneline = jQuery("#wpseo_oneline").is(":checked") ? ' oneline="1"' : '';
		            var show_state = jQuery("#wpseo_show_state").is(":checked") ? ' show_state="1"' : ' show_state="0"';
		            var show_country = jQuery("#wpseo_show_country").is(":checked") ? ' show_country="1"' : ' show_country="0"';
		            var show_phone = jQuery("#wpseo_show_phone").is(":checked") ? ' show_phone="1"' : ' show_phone="0"';
		            var show_phone_2 = jQuery("#wpseo_show_phone_2").is(":checked") ? ' show_phone_2="1"' : ' show_phone_2="0"';
		            var show_fax = jQuery("#wpseo_show_fax").is(":checked") ? ' show_fax="1"' : ' show_fax="0"';
		            var show_email = jQuery("#wpseo_show_email").is(":checked") ? ' show_email="1"' : ' show_email="0"';
		            var show_url = jQuery("#wpseo_show_url").is(":checked") ? ' show_url="1"' : '';
			        var show_vat = jQuery("#wpseo_show_vat_id").is(":checked") ? ' show_vat="1"' : '';
			        var show_tax = jQuery("#wpseo_show_tax_id").is(":checked") ? ' show_tax="1"' : '';
			        var show_coc = jQuery("#wpseo_show_coc_id").is(":checked") ? ' show_coc="1"' : '';
		            var show_opening_hours = jQuery("#wpseo_show_opening_hours").is(":checked") ? ' show_opening_hours="1"' : '';
		            var hide_closed = jQuery("#wpseo_hide_closed").is(":checked") ? ' hide_closed="1"' : '';
		            var orderby = '';
		            var order = '';

		            var id = '';
		            if( location_id != 'undefined' && typeof location_id != 'undefined' ) {
		            	id = "id=\"" + location_id + "\" ";
		            }

		            var term = '';
		            if( term_id != 'undefined' && typeof term_id != 'undefined' && term_id != '' ) {
			        	term = "term_id=\"" + term_id + "\" ";
			        }

		            var shortcode_name = 'wpseo_address';
		            if( location_id == 'all' ) {
		            	shortcode_name = 'wpseo_all_locations';

		            	orderby = ' orderby=' + jQuery("#wpseo_address_all_locations_orderby").val();
		            	order = ' order=' + jQuery("#wpseo_address_all_locations_order").val();
		            }

		            window.send_to_editor("[" + shortcode_name + " " + id + term + hide_name + oneline + show_state + show_country + show_phone +show_phone_2 + show_fax + show_email + show_url + show_vat + show_tax + show_coc + show_opening_hours + hide_closed + orderby + order + "]");
		        }
		        function WPSEO_InsertOpeningHours() {
		        	var wrapper = jQuery('#wpseo_add_opening_hours');

		            var location_id = jQuery("#wpseo_oh_location_id").val();
		            if( location_id == '' ) {
		                alert("<?php 
            _e('Please select a location', 'yoast-local-seo');
            ?>
");
		                return;
		            }

		            var id = '';
		            if( location_id != 'undefined' && typeof location_id != 'undefined' ) {
		            	id = "id=\"" + location_id + "\" ";
		            }
		            var hide_closed = jQuery("#wpseo_oh_hide_closed").is(":checked") ? ' hide_closed="1"' : '';

		            window.send_to_editor("[wpseo_opening_hours " + id + hide_closed + "]");
		        }
		        <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
		        function WPSEO_InsertStorelocator() {
		        	var show_map = jQuery("#wpseo_sl_show_map").is(":checked") ? ' show_map="1"' : ' show_map="0"';
		        	var scrollable = jQuery("#wpseo_sl_scrollable").is(":checked") ? ' scrollable="1"' : ' scrollable="0"';
			        var draggable = jQuery("#wpseo_sl_draggable").is(":checked") ? ' draggable="1"' : ' draggable="0"';
		        	var show_radius = jQuery("#wpseo_sl_show_radius").is(":checked") ? ' show_radius="1"' : '';
		        	var show_nearest_suggestion = jQuery("#wpseo_sl_show_nearest_suggestion").is(":checked") ? ' show_nearest_suggestion="1"' : ' show_nearest_suggestion="0"';
		        	var show_filter = jQuery("#wpseo_sl_show_filter").is(":checked") ? ' show_filter="1"' : '';
		        	var radius = ' radius="' + jQuery("#wpseo_sl_radius").val() + '"';

		            var map_style = jQuery('input[name=wpseo_sl_map_style]:checked', '.wpseo_map_style').val()
		            var oneline = jQuery("#wpseo_sl_oneline").is(":checked") ? ' oneline="1"' : '';
		            var show_state = jQuery("#wpseo_sl_show_state").is(":checked") ? ' show_state="1"' : '';
		            var show_country = jQuery("#wpseo_sl_show_country").is(":checked") ? ' show_country="1"' : '';
		            var show_phone = jQuery("#wpseo_sl_show_phone").is(":checked") ? ' show_phone="1"' : '';
		            var show_phone_2 = jQuery("#wpseo_sl_show_phone_2").is(":checked") ? ' show_phone_2="1"' : '';
		            var show_fax = jQuery("#wpseo_sl_show_fax").is(":checked") ? ' show_fax="1"' : '';
		            var show_email = jQuery("#wpseo_sl_show_email").is(":checked") ? ' show_email="1"' : '';
		            var show_url = jQuery("#wpseo_sl_show_url").is(":checked") ? ' show_url="1"' : '';
		            var show_opening_hours = jQuery("#wpseo_sl_show_opening_hours").is(":checked") ? ' show_opening_hours="1"' : '';
		            var hide_closed = jQuery("#wpseo_sl_hide_closed").is(":checked") ? ' hide_closed="1"' : '';
		            window.send_to_editor("[wpseo_storelocator " + show_map + scrollable + draggable + show_radius + show_nearest_suggestion + radius + show_filter + " map_style=\"" + map_style + "\"" + oneline + show_state + show_country + show_phone +show_phone_2 + show_fax + show_email + show_url + show_opening_hours + hide_closed + "]");
		        }

		        function WPSEO_Address_Change_Order( obj ) {
		        	if( jQuery(obj).val() == 'all' ) {
		        		jQuery( '#wpseo_address_all_locations_order_wrapper' ).slideDown();
		        	}
		        	else {
		        		jQuery( '#wpseo_address_all_locations_order_wrapper' ).slideUp();
		        		jQuery( '#wpseo_address_term_id' ).val('');
		        	}
		        }

		        function WPSEO_Address_Change_Term_Order( obj ) {
		        	if( jQuery(obj).val() != 'all' && jQuery(obj).val() != '' ) {
		        		jQuery( '#wpseo_address_location_id' ).val('all');
		        	}
		        }

		        function WPSEO_Map_Change_Location( obj ) {
		        	if( jQuery(obj).val() != 'all' ) {
		        		jQuery( '#wpseo_map_term_id' ).val('');
		        	}
		        }

		        function WPSEO_Map_Change_Term( obj ) {
		        	if( jQuery(obj).val() != 'all' && jQuery(obj).val() != '' ) {
		        		jQuery( '#wpseo_map_location_id' ).val('all');
		        	}
		        }
		        <?php 
            }
            ?>
		    </script>

		    <div id="wpseo_add_map" style="display:none;">
		        <div class="wrap">
		            <div>
		            	<style>
		            		.wpseo-textfield {
		            			border: 1px solid #dfdfdf;
		            			-webkit-border-radius: 3px;
		            			border-radius: 3px;
		            			width: 60px;
		            		}
		            		.wpseo-select {
		            			width: 100px;
		            		}
		            		.wpseo-for-textfield {
		            			display: inline-block;
		            			width: 70px;
		            		}
		            	</style>

		                <div style="padding:15px 15px 0 15px;">
		                    <h3><?php 
            _e('Insert Google Map', 'yoast-local-seo');
            ?>
</h3>
		                </div>

		                <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
		                <div style="padding:15px 15px 0 15px;">
		                    <select id="wpseo_map_location_id" onchange="WPSEO_Map_Change_Location( this )">
		                        <option value="">  -- <?php 
                _e('Select a location', 'yoast-local-seo');
                ?>
  -- </option>
		                        <?php 
                $locations = get_posts(array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'fields' => 'ids'));
                if (!empty($locations)) {
                    echo '<option value="all">' . __('All locations', 'yoast-local-seo') . '</option>';
                    foreach ($locations as $location_id) {
                        ?>
				                            <option value="<?php 
                        echo $location_id;
                        ?>
" <?php 
                        selected($location_id, get_the_ID(), true);
                        ?>
><?php 
                        echo get_the_title($location_id);
                        ?>
</option>
			                                <?php 
                    }
                }
                ?>
		                    </select>
		                    <select id="wpseo_map_term_id" onchange="WPSEO_Map_Change_Term( this )">
		                        <option value="">  -- <?php 
                _e('Select a category', 'yoast-local-seo');
                ?>
  -- </option>
		                        <?php 
                $categories = get_terms('wpseo_locations_category', array('hide_empty' => false));
                foreach ($categories as $category) {
                    ?>
		                                <option value="<?php 
                    echo $category->term_id;
                    ?>
"><?php 
                    echo $category->name;
                    ?>
</option>
		                                <?php 
                }
                ?>
		                    </select> <br/>
			                <p><?php 
                _e('Center map on this location', 'yoast-local-seo');
                ?>
</p>
			                <select id="wpseo_map_center_location_id"">
				                <?php 
                $locations = get_posts(array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'fields' => 'ids'));
                if (!empty($locations)) {
                    echo '<option value="">' . __('All locations', 'yoast-local-seo') . '</option>';
                    foreach ($locations as $location_id) {
                        ?>
						                <option value="<?php 
                        echo $location_id;
                        ?>
" <?php 
                        selected($location_id, get_the_ID(), true);
                        ?>
><?php 
                        echo get_the_title($location_id);
                        ?>
</option>
						                <?php 
                    }
                }
                ?>
			                </select>
		                </div>
		                <?php 
            }
            ?>

		                <div style="padding:15px 15px 0 15px;">
		                	<label class="wpseo-for-textfield"><?php 
            _e('Map style', 'yoast-local-seo');
            ?>
: </label>
		                	<ul>
		                	<?php 
            $map_styles = array('ROADMAP' => __('Roadmap', 'yoast-local-seo'), 'HYBRID' => __('Hybrid', 'yoast-local-seo'), 'SATELLITE' => __('Satellite', 'yoast-local-seo'), 'TERRAIN' => __('Terrain', 'yoast-local-seo'));
            foreach ($map_styles as $key => $label) {
                ?>
		                			<li class="wpseo_map_style" style="display: inline-block; width: 120px; height: 150px; margin-right: 10px;text-align: center;">
		                				<label for="wpseo_map_style-<?php 
                echo strtolower($key);
                ?>
">
		                					<img src="<?php 
                echo plugins_url('/images/map-' . strtolower($key) . '.png', dirname(__FILE__));
                ?>
" alt="<?php 
                echo $label;
                ?>
"><br>
		                					<?php 
                echo $label;
                ?>
<br>
		                					<input type="radio" name="wpseo_map_style" id="wpseo_map_style-<?php 
                echo strtolower($key);
                ?>
" value="<?php 
                echo strtolower($key);
                ?>
" <?php 
                checked('ROADMAP', $key);
                ?>
>
		                				</label>
		                			</li>
		                			<?php 
            }
            ?>
		                	</ul>
		                </div>

		                <div style="padding:15px 15px 0 15px;">
		                	<label class="wpseo-for-textfield" for="wpseo_map_width"><?php 
            _e('Width', 'yoast-local-seo');
            ?>
: </label><input id="wpseo_map_width" class="wpseo-textfield" value="400"><br>
		                	<label class="wpseo-for-textfield" for="wpseo_map_height"><?php 
            _e('Height', 'yoast-local-seo');
            ?>
: </label><input id="wpseo_map_height" class="wpseo-textfield" value="300"><br>
		                	<label class="wpseo-for-textfield" for="wpseo_map_zoom"><?php 
            _e('Zoom level', 'yoast-local-seo');
            ?>
: </label>
		                	<select id="wpseo_map_zoom" class="wpseo-select" value="300">
		                		<option value="-1"><?php 
            _e('Auto', 'yoast-local-seo');
            ?>
</option>
		                		<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option>
		                	</select><br>
		                	<br>
		                	<input type="checkbox" id="wpseo_map_scrollable" checked="checked" /> <label for="wpseo_map_scrollable"><?php 
            _e('Allow scrolling of the map', 'yoast-local-seo');
            ?>
</label><br>
			                <input type="checkbox" id="wpseo_map_draggable" checked="checked" /> <label for="wpseo_map_draggable"><?php 
            _e('Allow dragging of the map', 'yoast-local-seo');
            ?>
</label><br>
		                	<input type="checkbox" id="wpseo_map_show_route" /> <label for="wpseo_map_show_route"><?php 
            _e('Show route planner', 'yoast-local-seo');
            ?>
</label><br>
		                    <input type="checkbox" id="wpseo_map_show_state" /> <label for="wpseo_map_show_state"><?php 
            _e('Show state in info-popup', 'yoast-local-seo');
            ?>
</label><br>
		                    <input type="checkbox" id="wpseo_map_show_country" /> <label for="wpseo_map_show_country"><?php 
            _e('Show country in info-popup', 'yoast-local-seo');
            ?>
</label><br>
		                    <input type="checkbox" id="wpseo_map_show_url" /> <label for="wpseo_map_show_url"><?php 
            _e('Show URL in info-popup', 'yoast-local-seo');
            ?>
</label><br>
		                    <input type="checkbox" id="wpseo_map_show_email" /> <label for="wpseo_map_show_email"><?php 
            _e('Show email in info popup', 'yoast-local-seo');
            ?>
</label><br>
		                </div>
		                <div style="padding:15px;">
		                    <input type="button" class="button-primary" value="<?php 
            _e('Insert map', 'yoast-local-seo');
            ?>
" onclick="WPSEO_InsertMap();"/>&nbsp;&nbsp;&nbsp;
							<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;"><?php 
            _e("Cancel", "yoast-local-seo");
            ?>
</a>
		                </div>
		            </div>
		        </div>
		    </div>
		    <div id="wpseo_add_address" style="display:none;">
		        <div class="wrap">
		            <div>
		                <div style="padding:15px 15px 0 15px;">
		                    <h3><?php 
            _e('Insert Address', 'yoast-local-seo');
            ?>
</h3>
		                </div>

		                <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
		                <div style="padding:15px 15px 0 15px;">
		                    <select id="wpseo_address_location_id" onchange="WPSEO_Address_Change_Order( this );">
		                        <option value="">  -- <?php 
                _e('Select a location', 'yoast-local-seo');
                ?>
  -- </option>
		                        <?php 
                $locations = get_posts(array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'fields' => 'ids'));
                if (!empty($locations)) {
                    echo '<option value="all">' . __('Show all locations', 'yoast-local-seo') . '</option>';
                    foreach ($locations as $location_id) {
                        ?>
					                        <option value="<?php 
                        echo $location_id;
                        ?>
" <?php 
                        selected($location_id, get_the_ID(), true);
                        ?>
><?php 
                        echo get_the_title($location_id);
                        ?>
</option>
				                            <?php 
                    }
                }
                ?>
		                    </select>
		                    <?php 
                $categories = get_terms('wpseo_locations_category', array('hide_empty' => false));
                if (!is_wp_error($categories) && !empty($categories)) {
                    ?>
			                    <select id="wpseo_address_term_id" onchange="WPSEO_Address_Change_Term_Order( this );">
			                        <option value="">  -- <?php 
                    _e('Select a category', 'yoast-local-seo');
                    ?>
  -- </option>
			                        <?php 
                    foreach ($categories as $category) {
                        ?>
			                                <option value="<?php 
                        echo $category->term_id;
                        ?>
"><?php 
                        echo $category->name;
                        ?>
</option>
			                                <?php 
                    }
                    ?>
			                    </select>
		                    <?php 
                }
                ?>

		                    <br/>

		                    <div id="wpseo_address_all_locations_order_wrapper" style="display: none;">
		                    	<label for="wpseo_address_all_locations_orderby"><?php 
                _e('Order by', 'yoast-local-seo');
                ?>
: </label>
		                    	<select name="wpseo_address_all_locations_orderby" id="wpseo_address_all_locations_orderby">
		                    		<option value="title"><?php 
                _e('Alphabetical', 'yoast-local-seo');
                ?>
</option>
		                    		<option value="date"><?php 
                _e('By publish date', 'yoast-local-seo');
                ?>
</option>
		                    	</select><br>

		                    	<label for="wpseo_address_all_locations_order"><?php 
                _e('Order', 'yoast-local-seo');
                ?>
: </label>
		                    	<select name="wpseo_address_all_locations_order" id="wpseo_address_all_locations_order">
		                    		<option value="ASC"><?php 
                _e('Ascending', 'yoast-local-seo');
                ?>
</option>
		                    		<option value="DESC"><?php 
                _e('Descending', 'yoast-local-seo');
                ?>
</option>
		                    	</select>
		                    </div>
		                </div>
		                <?php 
            }
            ?>

		                <div style="padding:15px 15px 0 15px;">
		                	<label for="wpseo_hide_name"><input type="checkbox" id="wpseo_hide_name" /> <?php 
            _e('Hide business name', 'yoast-local-seo');
            ?>
</label><br>
		                	<label for="wpseo_oneline"><input type="checkbox" id="wpseo_oneline" /> <?php 
            _e('Show address on one line', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_state"><input type="checkbox" id="wpseo_show_state" checked /> <?php 
            _e('Show state', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_country"><input type="checkbox" id="wpseo_show_country" checked /> <?php 
            _e('Show country', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_phone"><input type="checkbox" id="wpseo_show_phone" checked /> <?php 
            _e('Show phone number', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_phone_2nd"><input type="checkbox" id="wpseo_show_phone_2nd" checked /> <?php 
            _e('Show 2nd phone number', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_fax"><input type="checkbox" id="wpseo_show_fax" checked /> <?php 
            _e('Show fax number', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_email"><input type="checkbox" id="wpseo_show_email" checked /> <?php 
            _e('Show email', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_url"><input type="checkbox" id="wpseo_show_url" /> <?php 
            _e('Show URL', 'yoast-local-seo');
            ?>
</label><br>
			                <label for="wpseo_show_vat_id"><input type="checkbox" id="wpseo_show_vat_id" /> <?php 
            _e('Show VAT ID', 'yoast-local-seo');
            ?>
</label><br>
			                <label for="wpseo_show_tax_id"><input type="checkbox" id="wpseo_show_tax_id" /> <?php 
            _e('Show Tax ID', 'yoast-local-seo');
            ?>
</label><br>
			                <label for="wpseo_show_coc_id"><input type="checkbox" id="wpseo_show_coc_id" /> <?php 
            _e('Show Chamber of Commerce ID', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_show_opening_hours"><input type="checkbox" id="wpseo_show_opening_hours" /> <?php 
            _e('Show opening hours', 'yoast-local-seo');
            ?>
</label><br>
		                    <label for="wpseo_hide_closed"><input type="checkbox" id="wpseo_hide_closed" /> <?php 
            _e('Hide closed days', 'yoast-local-seo');
            ?>
</label><br>
		                </div>
		                <div style="padding:15px;">
		                    <input type="button" class="button-primary" value="<?php 
            _e('Insert address', 'yoast-local-seo');
            ?>
" onclick="WPSEO_InsertAddress();"/>&nbsp;&nbsp;&nbsp;
		                	<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;"><?php 
            _e("Cancel", "yoast-local-seo");
            ?>
</a>
		                </div>
		            </div>
		        </div>
		    </div>
		    <div id="wpseo_add_opening_hours" style="display:none;">
		        <div class="wrap">
		            <div>
		                <div style="padding:15px 15px 0 15px;">
		                    <h3><?php 
            _e('Insert Opening Hours', 'yoast-local-seo');
            ?>
</h3>
		                </div>

		                <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
		                <div style="padding:15px 15px 0 15px;">
		                    <select id="wpseo_oh_location_id">
		                        <option value="">  -- <?php 
                _e('Select a location', 'yoast-local-seo');
                ?>
  -- </option>
		                        <?php 
                $locations = get_posts(array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'fields' => 'ids'));
                foreach ($locations as $location_id) {
                    ?>
		                                <option value="<?php 
                    echo $location_id;
                    ?>
" <?php 
                    selected($location_id, get_the_ID(), true);
                    ?>
><?php 
                    echo get_the_title($location_id);
                    ?>
</option>
		                                <?php 
                }
                ?>
		                    </select> <br/>

		                </div>
		                <?php 
            }
            ?>

		                <div style="padding:15px 15px 0 15px;">
		                	<label for="wpseo_oh_hide_closed"><input type="checkbox" id="wpseo_oh_hide_closed" /> <?php 
            _e('Hide closed days', 'yoast-local-seo');
            ?>
</label>
		                </div>
		                <div style="padding:15px;">
		                    <input type="button" class="button-primary" value="<?php 
            _e('Insert opening hours', 'yoast-local-seo');
            ?>
" onclick="WPSEO_InsertOpeningHours();"/>&nbsp;&nbsp;&nbsp;
							<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;"><?php 
            _e("Cancel", "yoast-local-seo");
            ?>
</a>
		                </div>
		            </div>
		        </div>
		    </div>

		    <?php 
            if (wpseo_has_multiple_locations()) {
                ?>
		    <div id="wpseo_add_storelocator" style="display:none;">
		        <div class="wrap">
		            <div>
		                <div style="padding:15px 15px 0 15px;">
		                    <h3><?php 
                _e('Insert Store locator', 'yoast-local-seo');
                ?>
</h3>
		                </div>

		                <div style="padding:15px 15px 0 15px;">
		                	<label for="wpseo_sl_show_map"><input type="checkbox" id="wpseo_sl_show_map" checked="checked" /> <?php 
                _e('Show Map with the search results', 'yoast-local-seo');
                ?>
</label><br>
		                	<label for="wpseo_sl_scrollable"><input type="checkbox" id="wpseo_sl_scrollable" checked="checked" /> <?php 
                _e('Allow scrolling of the map', 'yoast-local-seo');
                ?>
</label><br>
			                <label for="wpseo_sl_draggable"><input type="checkbox" id="wpseo_sl_draggable" checked="checked" /> <?php 
                _e('Allow dragging of the map', 'yoast-local-seo');
                ?>
</label><br>
		                	<label for="wpseo_sl_show_filter"><input type="checkbox" id="wpseo_sl_show_filter" /> <?php 
                _e('Show filter to narrow down search results', 'yoast-local-seo');
                ?>
</label><br>
		                	<label for="wpseo_sl_show_radius"><input type="checkbox" id="wpseo_sl_show_radius" /> <?php 
                _e('Show radius to limit your search', 'yoast-local-seo');
                ?>
</label><br>
		                	<label for="wpseo_sl_show_nearest_suggestion"><input type="checkbox" id="wpseo_sl_show_nearest_suggestion" checked="checked" /> <?php 
                _e('Show the nearest location, if none are found within radius', 'yoast-local-seo');
                ?>
</label><br>
		                	
		                	<br>
		                	<label for="wpseo_sl_radius"><?php 
                printf(__('Search radius (in %s)', 'yoast-local-seo'), empty($this->options['unit_system']) || $this->options['unit_system'] == 'METRIC' ? 'km' : 'mi');
                ?>
 <input type="text" id="wpseo_sl_radius" value="10" /></label><br>
		                </div>
		                <div style="padding:0 15px 0 15px;">
		                	<p><?php 
                _e('Please specify below how the search results should look like.', 'yoast-local-seo');
                ?>
</p>
		                	<label class="wpseo-for-textfield"><?php 
                _e('Map style', 'yoast-local-seo');
                ?>
: </label>
		                	<ul>
		                	<?php 
                $map_styles = array('ROADMAP' => __('Roadmap', 'yoast-local-seo'), 'HYBRID' => __('Hybrid', 'yoast-local-seo'), 'SATELLITE' => __('Satellite', 'yoast-local-seo'), 'TERRAIN' => __('Terrain', 'yoast-local-seo'));
                foreach ($map_styles as $key => $label) {
                    ?>
		                			<li class="wpseo_map_style" style="display: inline-block; width: 120px; height: 150px; margin-right: 10px;text-align: center;">
		                				<label for="wpseo_sl_map_style-<?php 
                    echo strtolower($key);
                    ?>
">
		                					<img src="<?php 
                    echo plugins_url('/images/map-' . strtolower($key) . '.png', dirname(__FILE__));
                    ?>
" alt="<?php 
                    echo $label;
                    ?>
"><br>
		                					<?php 
                    echo $label;
                    ?>
<br>
		                					<input type="radio" name="wpseo_sl_map_style" id="wpseo_sl_map_style-<?php 
                    echo strtolower($key);
                    ?>
" value="<?php 
                    echo strtolower($key);
                    ?>
" <?php 
                    checked('ROADMAP', $key);
                    ?>
>
		                				</label>
		                			</li>
		                			<?php 
                }
                ?>
		                	</ul>
		                	<label for="wpseo_sl_oneline"><input type="checkbox" id="wpseo_sl_oneline" /> <?php 
                _e('Show address on one line', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_state"><input type="checkbox" id="wpseo_sl_show_state" /> <?php 
                _e('Show state', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_country"><input type="checkbox" id="wpseo_sl_show_country" /> <?php 
                _e('Show country', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_phone"><input type="checkbox" id="wpseo_sl_show_phone" /> <?php 
                _e('Show phone number', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_phone_2nd"><input type="checkbox" id="wpseo_sl_show_phone_2nd" /> <?php 
                _e('Show 2nd phone number', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_fax"><input type="checkbox" id="wpseo_sl_show_fax" /> <?php 
                _e('Show fax number', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_email"><input type="checkbox" id="wpseo_sl_show_email" /> <?php 
                _e('Show email', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_url"><input type="checkbox" id="wpseo_sl_show_url" /> <?php 
                _e('Show URL', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_show_opening_hours"><input type="checkbox" id="wpseo_sl_show_opening_hours" /> <?php 
                _e('Show opening hours', 'yoast-local-seo');
                ?>
</label><br>
		                    <label for="wpseo_sl_hide_closed"><input type="checkbox" id="wpseo_sl_hide_closed" /> <?php 
                _e('Hide closed days', 'yoast-local-seo');
                ?>
</label><br>
		                </div>
		                <div style="padding:15px;">
		                    <input type="button" class="button-primary" value="<?php 
                _e('Insert Store locator', 'yoast-local-seo');
                ?>
" onclick="WPSEO_InsertStorelocator();"/>&nbsp;&nbsp;&nbsp;
		                	<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;"><?php 
                _e("Cancel", "yoast-local-seo");
                ?>
</a>
		                </div>
		            </div>
		        </div>
		    </div>
		    <?php 
            }
            ?>

		    <?php 
        }
예제 #4
0
 /**
  * Filter the OG title output
  *
  * @param string $title
  *
  * @return string
  */
 function opengraph_title_filter($title)
 {
     if ("on" == WPSEO_Meta::get_value('opengraph-local') && !wpseo_has_multiple_locations()) {
         return get_bloginfo('name');
     } else {
         if (wpseo_has_multiple_locations() && is_singular('wpseo_locations')) {
             return get_the_title(get_the_ID());
         }
     }
     return $title;
 }
예제 #5
0
<?php

if (wpseo_has_multiple_locations()) {
    add_action('widgets_init', create_function('', 'return register_widget("WPSEO_Storelocator_Form");'));
}
class WPSEO_Storelocator_Form extends WP_Widget
{
    /** constructor */
    function WPSEO_Storelocator_Form()
    {
        $widget_options = array('classname' => 'WPSEO_Storelocator_Form', 'description' => __('Shows form to search the nearest store. Will submit to the page which contains the store locator.', 'yoast-local-seo'));
        parent::__construct(false, $name = __('WP SEO - Storelocator form', 'yoast-local-seo'), $widget_options);
    }
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        $search_label = !empty($instance['search_label']) ? $instance['search_label'] : __('Enter your postal code or city', 'yoast-local-seo');
        $radius = !empty($instance['radius']) ? $instance['radius'] : 10;
        $page_id = !empty($instance['page_id']) ? $instance['page_id'] : '';
        if (empty($page_id)) {
            return '';
        }
        if (isset($args['before_widget'])) {
            echo $args['before_widget'];
        }
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        $search_string = isset($_REQUEST['wpseo-sl-search']) ? esc_attr($_REQUEST['wpseo-sl-search']) : '';
        ?>
예제 #6
0
    /** @see WP_Widget::form */
    function form($instance)
    {
        $title = !empty($instance['title']) ? esc_attr($instance['title']) : '';
        $location_id = !empty($instance['location_id']) ? esc_attr($instance['location_id']) : '';
        $hide_closed = !empty($instance['hide_closed']) && esc_attr($instance['hide_closed']) == '1';
        $comment = !empty($instance['comment']) ? esc_attr($instance['comment']) : '';
        ?>
		<p>
			<label
					for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'yoast-local-seo');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
"
						 name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" />
		</p>

		<?php 
        if (wpseo_has_multiple_locations()) {
            ?>
			<p>
				<label
						for="<?php 
            echo $this->get_field_id('location_id');
            ?>
"><?php 
            _e('Location:', 'yoast-local-seo');
            ?>
</label>
				<?php 
            $args = array('post_type' => 'wpseo_locations', 'orderby' => 'name', 'order' => 'ASC', 'posts_per_page' => -1, 'fields' => 'ids');
            $locations = get_posts($args);
            ?>
				<select name="<?php 
            echo $this->get_field_name('location_id');
            ?>
"
								id="<?php 
            echo $this->get_field_id('location_id');
            ?>
">
					<option value=""><?php 
            _e('Select a location', 'yoast-local-seo');
            ?>
</option>
					<option value="current" <?php 
            selected($location_id, 'current');
            ?>
><?php 
            _e('Use current location', 'yoast-local-seo');
            ?>
</option>
					<?php 
            foreach ($locations as $loc_id) {
                ?>
						<option
								value="<?php 
                echo $loc_id;
                ?>
" <?php 
                selected($location_id, $loc_id);
                ?>
><?php 
                echo get_the_title($loc_id);
                ?>
</option>
					<?php 
            }
            ?>
				</select>
			</p>
		<?php 
        }
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('hide_closed');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('hide_closed');
        ?>
"
							 name="<?php 
        echo $this->get_field_name('hide_closed');
        ?>
" type="checkbox"
							 value="1" <?php 
        echo !empty($hide_closed) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Hide closed days', 'yoast-local-seo');
        ?>
			</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('comment');
        ?>
"><?php 
        _e('Extra comment', 'yoast-local-seo');
        ?>
</label>
			<textarea id="<?php 
        echo $this->get_field_id('comment');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('comment');
        ?>
"><?php 
        echo esc_attr($comment);
        ?>
</textarea>
		</p>

	<?php 
    }
예제 #7
0
/**
 * Places scripts in footer for Google Maps use.
 */
function wpseo_enqueue_geocoder()
{
    global $wpseo_enqueue_geocoder, $wpseo_map;
    if (is_admin() && 'wpseo_locations' == get_post_type()) {
        global $wpseo_enqueue_geocoder;
        $wpseo_enqueue_geocoder = true;
    }
    if ($wpseo_enqueue_geocoder) {
        $locale = get_locale();
        $locale = explode('_', $locale);
        $language = isset($locale[1]) ? $locale[1] : $locale[0];
        $options = get_option("wpseo_local");
        wp_enqueue_script('maps-geocoder', '//maps.google.com/maps/api/js?sensor=false' . (!empty($language) ? '&language=' . strtolower($language) : ''), array(), null, true);
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            wp_enqueue_script('wpseo-local-frontend', plugins_url('js/wp-seo-local-frontend.js', dirname(__FILE__)), '', WPSEO_LOCAL_VERSION, true);
        } else {
            wp_enqueue_script('wpseo-local-frontend', plugins_url('js/wp-seo-local-frontend.min.js', dirname(__FILE__)), '', WPSEO_LOCAL_VERSION, true);
        }
        wp_localize_script('wpseo-local-frontend', 'wpseo_local_data', array('ajaxurl' => 'admin-ajax.php', 'has_multiple_locations' => wpseo_has_multiple_locations(), 'unit_system' => !empty($options['unit_system']) ? $options['unit_system'] : 'METRIC'));
        echo '<style type="text/css">.wpseo-map-canvas img { max-width: none !important; }</style>' . PHP_EOL;
    }
    echo $wpseo_map;
}
예제 #8
0
    /** @see WP_Widget::form */
    function form($instance)
    {
        $title = !empty($instance['title']) ? esc_attr($instance['title']) : '';
        $cur_location_id = !empty($instance['location_id']) ? esc_attr($instance['location_id']) : '';
        $show_country = !empty($instance['show_country']) && esc_attr($instance['show_country']) == '1';
        $show_state = !empty($instance['show_state']) && esc_attr($instance['show_state']) == '1';
        $show_phone = !empty($instance['show_phone']) && esc_attr($instance['show_phone']) == '1';
        $show_phone_2 = !empty($instance['show_phone_2']) && esc_attr($instance['show_phone_2']) == '1';
        $show_fax = !empty($instance['show_fax']) && esc_attr($instance['show_fax']) == '1';
        $show_email = !empty($instance['show_email']) && esc_attr($instance['show_email']) == '1';
        $show_vat = !empty($instance['show_vat']) && esc_attr($instance['show_vat']) == '1';
        $show_tax = !empty($instance['show_tax']) && esc_attr($instance['show_tax']) == '1';
        $show_coc = !empty($instance['show_coc']) && esc_attr($instance['show_coc']) == '1';
        $show_opening_hours = !empty($instance['show_opening_hours']) && esc_attr($instance['show_opening_hours']) == '1';
        $hide_closed = !empty($instance['hide_closed']) && esc_attr($instance['hide_closed']) == '1';
        $show_oneline = !empty($instance['show_oneline']) && esc_attr($instance['show_oneline']) == '1';
        $comment = !empty($instance['comment']) ? esc_attr($instance['comment']) : '';
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'yoast-local-seo');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
"
				   name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
"/>
		</p>

		<?php 
        if (wpseo_has_multiple_locations()) {
            ?>
			<p>
				<label
					for="<?php 
            echo $this->get_field_id('location_id');
            ?>
"><?php 
            _e('Location:', 'yoast-local-seo');
            ?>
</label>
				<?php 
            $args = array('post_type' => 'wpseo_locations', 'orderby' => 'name', 'order' => 'ASC', 'posts_per_page' => -1, 'fields' => 'ids');
            $locations = get_posts($args);
            ?>
				<select name="<?php 
            echo $this->get_field_name('location_id');
            ?>
" id="<?php 
            echo $this->get_field_id('location_id');
            ?>
">
					<?php 
            if (!empty($locations)) {
                ?>
					<option value=""><?php 
                _e('Select a location', 'yoast-local-seo');
                ?>
</option>
					<option value="current" <?php 
                selected($cur_location_id, 'current');
                ?>
><?php 
                _e('Use current location', 'yoast-local-seo');
                ?>
</option>
					<?php 
                foreach ($locations as $location_id) {
                    echo '<option value="' . $location_id . '" ' . selected($cur_location_id, $location_id, false) . '>' . get_the_title($location_id) . '</option>';
                }
            }
            ?>
				</select>
			</p>
		<?php 
        }
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('show_country');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_country');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_country');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_country) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show country', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_state');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_state');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_state');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_state) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show state', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_phone');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_phone');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_phone');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_phone) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show phone number', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_phone_2');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_phone_2');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_phone_2');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_phone_2) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show second phone number', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_fax');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_fax');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_fax');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_fax) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show fax number', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_email');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_email');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_email');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_email) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show email address', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_vat');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_vat');
        ?>
"
				       name="<?php 
        echo $this->get_field_name('show_vat');
        ?>
" type="checkbox"
				       value="1" <?php 
        echo !empty($show_vat) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show VAT ID', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_tax');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_tax');
        ?>
"
				       name="<?php 
        echo $this->get_field_name('show_tax');
        ?>
" type="checkbox"
				       value="1" <?php 
        echo !empty($show_tax) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show Tax ID', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_coc');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_coc');
        ?>
"
				       name="<?php 
        echo $this->get_field_name('show_coc');
        ?>
" type="checkbox"
				       value="1" <?php 
        echo !empty($show_coc) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show Chamber of Commerce ID', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_opening_hours');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_opening_hours');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_opening_hours');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_opening_hours) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show opening hours', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('hide_closed');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('hide_closed');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('hide_closed');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($hide_closed) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Hide closed days', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_oneline');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_oneline');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_oneline');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_oneline) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show address in one line', 'yoast-local-seo');
        ?>
			</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('comment');
        ?>
"><?php 
        _e('Extra comment', 'yoast-local-seo');
        ?>
</label>
			<textarea id="<?php 
        echo $this->get_field_id('comment');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('comment');
        ?>
"><?php 
        echo esc_attr($comment);
        ?>
</textarea>
		</p>
	<?php 
    }
예제 #9
0
 /**
  * Retrieves the lat/long coordinates from the Google Maps API
  *
  * @param Array $location_info Array with location info. Array structure: array( _wpseo_business_address, _wpseo_business_city, _wpseo_business_state, _wpseo_business_zipcode, _wpseo_business_country )
  * @param bool  $force_update  Whether to force the update or not
  * @param int $post_id
  *
  * @return bool|array Returns coordinates in array ( Format: array( 'lat', 'long' ) ). False when call the Maps API did not succeed
  */
 public function get_geo_data($location_info, $force_update = false, $post_id = 0)
 {
     $full_address = wpseo_local_get_address_format($location_info['_wpseo_business_address'], false, $location_info['_wpseo_business_zipcode'], $location_info['_wpseo_business_city'], $location_info['_wpseo_business_state'], true, false, false) . ', ' . WPSEO_Local_Frontend::get_country($location_info['_wpseo_business_country']);
     $coordinates = array();
     if (($post_id === 0 || empty($post_id)) && isset($location_info['_wpseo_post_id'])) {
         $post_id = $location_info['_wpseo_post_id'];
     }
     if ($force_update || empty($location_info['_wpseo_coords']['lat']) || empty($location_info['_wpseo_coords']['long'])) {
         $results = wpseo_geocode_address($full_address);
         if (is_wp_error($results)) {
             return false;
         }
         if (isset($results->results[0]) && !empty($results->results[0])) {
             $coordinates['lat'] = $results->results[0]->geometry->location->lat;
             $coordinates['long'] = $results->results[0]->geometry->location->lng;
             if (wpseo_has_multiple_locations() && $post_id !== 0) {
                 update_post_meta($post_id, '_wpseo_coordinates_lat', $coordinates['lat']);
                 update_post_meta($post_id, '_wpseo_coordinates_long', $coordinates['long']);
             } else {
                 $options = get_option('wpseo_local');
                 $options['location_coords_lat'] = $coordinates['lat'];
                 $options['location_coords_long'] = $coordinates['long'];
                 update_option('wpseo_local', $options);
             }
         }
     } else {
         $coordinates['lat'] = $location_info['_wpseo_coords']['lat'];
         $coordinates['long'] = $location_info['_wpseo_coords']['long'];
     }
     $return_array['coords'] = $coordinates;
     $return_array["full_address"] = $full_address;
     return $return_array;
 }
예제 #10
0
    /** @see WP_Widget::form */
    function form($instance)
    {
        $title = !empty($instance['title']) ? esc_attr($instance['title']) : '';
        $location_id = !empty($instance['location_id']) ? esc_attr($instance['location_id']) : '';
        $show_all_locations = !empty($instance['show_all_locations']) && esc_attr($instance['show_all_locations']) == '1';
        $width = !empty($instance['width']) ? $instance['width'] : 400;
        $height = !empty($instance['height']) ? $instance['height'] : 300;
        $zoom = !empty($instance['zoom']) ? $instance['zoom'] : 10;
        $show_route = !empty($instance['show_route']) && esc_attr($instance['show_route']) == '1';
        $show_state = !empty($instance['show_state']) && esc_attr($instance['show_state']) == '1';
        $show_country = !empty($instance['show_country']) && esc_attr($instance['show_country']) == '1';
        $show_url = !empty($instance['show_url']) && esc_attr($instance['show_url']) == '1';
        ?>
		<p>
			<label
				for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'yoast-local-seo');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
"
				   name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
"/>
		</p>

		<?php 
        if (wpseo_has_multiple_locations()) {
            ?>

			<p><?php 
            _e('Choose to show all your locations in the map, otherwise just pick one in the selectbox below', 'yoast-local-seo');
            ?>
</p>
			<p id="wpseo-checkbox-multiple-locations-wrapper">
				<label for="<?php 
            echo $this->get_field_id('show_all_locations');
            ?>
">
					<input id="<?php 
            echo $this->get_field_id('show_all_locations');
            ?>
"
						   name="<?php 
            echo $this->get_field_name('show_all_locations');
            ?>
" type="checkbox"
						   value="1" <?php 
            echo !empty($show_all_locations) ? ' checked="checked"' : '';
            ?>
 />
					<?php 
            _e('Show all locations', 'yoast-local-seo');
            ?>
				</label>
			</p>

			<p id="wpseo-locations-wrapper" <?php 
            echo $show_all_locations ? 'style="display: none;"' : '';
            ?>
>
				<label
					for="<?php 
            echo $this->get_field_id('location_id');
            ?>
"><?php 
            _e('Location:', 'yoast-local-seo');
            ?>
</label>
				<?php 
            $args = array('post_type' => 'wpseo_locations', 'orderby' => 'name', 'order' => 'ASC', 'posts_per_page' => -1, 'fields' => 'ids');
            $locations = get_posts($args);
            ?>
				<select name="<?php 
            echo $this->get_field_name('location_id');
            ?>
"
						id="<?php 
            echo $this->get_field_id('location_id');
            ?>
">
					<option value=""><?php 
            _e('Select a location', 'yoast-local-seo');
            ?>
</option>
					<option value="current" <?php 
            selected($location_id, 'current');
            ?>
><?php 
            _e('Use current location', 'yoast-local-seo');
            ?>
</option>
					<?php 
            foreach ($locations as $loc_id) {
                ?>
						<option
							value="<?php 
                echo $loc_id;
                ?>
" <?php 
                selected($location_id, $loc_id);
                ?>
><?php 
                echo get_the_title($loc_id);
                ?>
</option>
					<?php 
            }
            ?>
				</select>
			</p>

		<?php 
        }
        ?>

		<h4><?php 
        _e('Maps settings', 'yoast-local-seo');
        ?>
</h4>
		<p>
			<label
				for="<?php 
        echo $this->get_field_id('width');
        ?>
"><?php 
        _e('Width:', 'yoast-local-seo');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
"
				   name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text" value="<?php 
        echo $width;
        ?>
"/>
		</p>
		<p>
			<label
				for="<?php 
        echo $this->get_field_id('height');
        ?>
"><?php 
        _e('Height:', 'yoast-local-seo');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('height');
        ?>
"
				   name="<?php 
        echo $this->get_field_name('height');
        ?>
" type="text" value="<?php 
        echo $height;
        ?>
"/>
		</p>
		<p>
			<?php 
        $nr_zoom_levels = 21;
        ?>
			<label
				for="<?php 
        echo $this->get_field_id('zoom');
        ?>
"><?php 
        _e('Zoom level:', 'yoast-local-seo');
        ?>
</label>
			<select class="" id="<?php 
        echo $this->get_field_id('zoom');
        ?>
"
					name="<?php 
        echo $this->get_field_name('zoom');
        ?>
">
				<?php 
        for ($i = 0; $i <= $nr_zoom_levels; $i++) {
            ?>
					<option
						value="<?php 
            echo $i;
            ?>
"<?php 
            echo $zoom == $i ? ' selected="selected"' : '';
            ?>
><?php 
            echo $i;
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_state');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_state');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_state');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_state) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show state in info-window', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_country');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_country');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_country');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_country) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show country in info-window', 'yoast-local-seo');
        ?>
			</label>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_url');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_url');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_url');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_url) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show URL in info-window', 'yoast-local-seo');
        ?>
			</label>
		</p>
		

		<p>
			<label for="<?php 
        echo $this->get_field_id('show_route');
        ?>
">
				<input id="<?php 
        echo $this->get_field_id('show_route');
        ?>
"
					   name="<?php 
        echo $this->get_field_name('show_route');
        ?>
" type="checkbox"
					   value="1" <?php 
        echo !empty($show_route) ? ' checked="checked"' : '';
        ?>
 />
				<?php 
        _e('Show route planner', 'yoast-local-seo');
        ?>
			</label>
		</p>
	<?php 
    }