public function markers()
 {
     $terms = get_terms(listify_get_top_level_taxonomy(), array('hide_empty' => 0));
     if (is_wp_error($terms)) {
         return;
     }
     foreach ($terms as $term) {
         $color = listify_theme_mod('marker-color-' . $term->term_id);
         $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ':after'), 'declarations' => array('border-top-color' => $color)));
         $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ' i:after'), 'declarations' => array('background-color' => $color)));
         $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ' i:before'), 'declarations' => array('color' => $color)));
     }
 }
 public function __construct()
 {
     $this->section = 'marker-appearance';
     $taxonomy = listify_get_top_level_taxonomy();
     $this->terms = get_terms($taxonomy, array('hide_empty' => 0));
     if (is_wp_error($this->terms)) {
         return;
     }
     $this->icons = $this->get_icon_list();
     parent::__construct();
     add_action('customize_register', array($this, 'add_controls'), 30);
     add_action('customize_register', array($this, 'set_controls'), 35);
 }
 public function listing_data($data)
 {
     global $post;
     $data['id'] = $post->ID;
     $data['link'] = get_permalink($post->ID);
     $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
     if (!is_array($image)) {
         $image = listify_get_cover_from_group(array('size' => 'thumbnail'));
     }
     if (is_array($image) && isset($image[0])) {
         $data['thumb'] = $image[0];
     }
     $data['title'] = the_title_attribute(array('post' => $post, 'echo' => false));
     $data['address'] = get_the_job_location($post->ID);
     /** Longitude */
     $long = esc_attr($post->geolocation_long);
     if ($long) {
         $data['longitude'] = $long;
     }
     /** Latitude */
     $lat = esc_attr($post->geolocation_lat);
     if ($lat) {
         $data['latitude'] = $lat;
     }
     /** Type (default) */
     $terms = get_the_terms(get_the_ID(), listify_get_top_level_taxonomy());
     $term_id = null;
     /** Color (default) */
     $default_color = apply_filters('listify_default_marker_color', listify_theme_mod('color-primary'));
     /** Icon (default) */
     $default_icon = apply_filters('listify_default_marker_icon', 'ion-information-circled');
     if (!is_wp_error($terms) && !empty($terms)) {
         /** Color */
         $color = listify_theme_mod('marker-color-' . current($terms)->term_id);
         $data['color'] = $color ? $color : $default_color;
         /** Icon */
         $icon = listify_theme_mod('marker-icon-' . current($terms)->term_id);
         $data['icon'] = $icon ? $icon : $default_icon;
         /** Term */
         $term_id = current($terms)->term_id;
         $data['term'] = $term_id;
     } else {
         $data['icon'] = $default_icon;
         $data['color'] = $default_color;
         $data['term'] = 0;
     }
     foreach ($data as $key => $value) {
         $data[$key] = esc_attr(strip_tags($value));
     }
     return $data;
 }
 /** Single Listing Item ---------------------------------------------------- */
 public function enqueue_scripts()
 {
     $preview = is_page(get_option('job_manager_submit_job_form_page_id', false));
     if (!(is_singular('job_listing') || $preview)) {
         return;
     }
     global $listify_job_manager, $post;
     $listify_job_manager->map->template->enqueue_scripts(true);
     $terms = get_the_terms($post->ID, listify_get_top_level_taxonomy());
     $term_id = null;
     $default_icon = apply_filters('listify_default_marker_icon', 'ion-information-circled');
     if (!is_wp_error($terms) && !empty($terms)) {
         $term = current($terms)->term_id;
         $icon = listify_theme_mod('marker-icon-' . current($terms)->term_id);
         $icon = $icon ? $icon : $default_icon;
     } else {
         $term = '';
         $icon = $default_icon;
     }
     $vars = array('lat' => $post->geolocation_lat, 'lng' => $post->geolocation_long, 'term' => $term, 'icon' => $icon, 'mapOptions' => array('zoom' => apply_filters('listify_single_listing_map_zoom', 15)));
     if ($preview && isset($_POST['geo_lat'])) {
         $lat = isset($_POST['geo_lat']) ? esc_attr($_POST['geo_lat']) : '';
         $lng = isset($_POST['geo_lng']) ? esc_attr($_POST['geo_lng']) : '';
         $vars['lat'] = $lat;
         $vars['lng'] = $lng;
     }
     $vars = apply_filters('listify_single_map_settings', $vars);
     wp_enqueue_script('listify-app-listing', get_template_directory_uri() . '/inc/integrations/wp-job-manager/js/listing/app.min.js', array('listify-app-map'));
     wp_localize_script('listify-app-listing', 'listifySingleMap', $vars);
 }
 /**
  * Add supplimentary data to individual listings so we can plot
  * and other things with it.
  *
  * @since Listify 1.0.0
  *
  * @param array $data
  * @return array $data
  */
 public function job_listing_data($data)
 {
     global $post, $listify_job_manager;
     $data = $output = array();
     /** Longitude */
     $long = esc_attr($post->geolocation_long);
     if ($long) {
         $data['longitude'] = $long;
     }
     /** Latitude */
     $lat = esc_attr($post->geolocation_lat);
     if ($lat) {
         $data['latitude'] = $lat;
     }
     /** Type (default) */
     $terms = get_the_terms(get_the_ID(), listify_get_top_level_taxonomy());
     $term_id = null;
     /** Color (default) */
     $default_color = apply_filters('listify_default_marker_color', listify_theme_mod('color-primary'));
     /** Icon (default) */
     $default_icon = apply_filters('listify_default_marker_icon', 'ion-information-circled');
     if (!is_wp_error($terms) && !empty($terms)) {
         /** Color */
         $color = listify_theme_mod('marker-color-' . current($terms)->term_id);
         $data['color'] = $color ? $color : $default_color;
         /** Icon */
         $icon = listify_theme_mod('marker-icon-' . current($terms)->term_id);
         $data['icon'] = $icon ? $icon : $default_icon;
         /** Term */
         $term_id = current($terms)->term_id;
         $data['term'] = $term_id;
     } else {
         $data['icon'] = $default_icon;
         $data['color'] = $default_color;
         $data['term'] = '';
     }
     /** Cols */
     $data['grid-columns'] = $this->get_grid_columns();
     foreach ($data as $key => $value) {
         $output[] .= sprintf('data-%s="%s"', $key, $value);
     }
     return implode(' ', $output);
 }