@@ -160,7 +160,6 @@ |
||
| 160 | 160 | * @uses wl_shortcode_geomap_get_places() in order to retrieve places |
| 161 | 161 | * @uses wl_shortcode_geomap_prepare_map() in order to encode retireved places in a Leaflet friendly format |
| 162 | 162 | * |
| 163 | - * @param array $places An array of place posts. |
|
| 164 | 163 | * |
| 165 | 164 | * @return array An array of place posts. |
| 166 | 165 | */ |
@@ -18,58 +18,58 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function wl_shortcode_geomap_get_places( $post_id = null ) { |
| 20 | 20 | |
| 21 | - // If $post_id is null or is not numeric it means this is a global geomap |
|
| 22 | - $is_global = is_null( $post_id ) || ! is_numeric( $post_id ); |
|
| 21 | + // If $post_id is null or is not numeric it means this is a global geomap |
|
| 22 | + $is_global = is_null( $post_id ) || ! is_numeric( $post_id ); |
|
| 23 | 23 | |
| 24 | - // If the current one is not a global geomap, retrieve related entities ids |
|
| 25 | - if ( $is_global ) { |
|
| 26 | - $related_ids = array(); |
|
| 27 | - } else { |
|
| 28 | - $related_ids = wl_core_get_related_entity_ids( $post_id, array( |
|
| 29 | - 'status' => 'publish', |
|
| 30 | - ) ); |
|
| 24 | + // If the current one is not a global geomap, retrieve related entities ids |
|
| 25 | + if ( $is_global ) { |
|
| 26 | + $related_ids = array(); |
|
| 27 | + } else { |
|
| 28 | + $related_ids = wl_core_get_related_entity_ids( $post_id, array( |
|
| 29 | + 'status' => 'publish', |
|
| 30 | + ) ); |
|
| 31 | 31 | |
| 32 | - // Also include current entity |
|
| 33 | - if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) { |
|
| 34 | - $related_ids[] = $post_id; |
|
| 35 | - } |
|
| 36 | - } |
|
| 32 | + // Also include current entity |
|
| 33 | + if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) { |
|
| 34 | + $related_ids[] = $post_id; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - // If is not a global geomap, an empty $related_ids means that no entities are related to the post |
|
| 39 | - // An empty array can be returned in this case |
|
| 40 | - if ( ! $is_global && empty( $related_ids ) ) { |
|
| 41 | - return array(); |
|
| 42 | - } |
|
| 38 | + // If is not a global geomap, an empty $related_ids means that no entities are related to the post |
|
| 39 | + // An empty array can be returned in this case |
|
| 40 | + if ( ! $is_global && empty( $related_ids ) ) { |
|
| 41 | + return array(); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - // Retrieve all 'published' places with geo coordinates defined |
|
| 45 | - // If $related_ids is not empty, it's used to limit query results to the current post related places |
|
| 46 | - // Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query |
|
| 47 | - return get_posts( array( |
|
| 48 | - 'post__in' => $related_ids, |
|
| 49 | - 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 50 | - 'nopaging' => true, |
|
| 51 | - 'post_status' => 'publish', |
|
| 52 | - 'meta_query' => array( |
|
| 53 | - 'relation' => 'AND', |
|
| 54 | - array( |
|
| 55 | - 'key' => Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
|
| 56 | - 'value' => null, |
|
| 57 | - 'compare' => '!=', |
|
| 58 | - ), |
|
| 59 | - array( |
|
| 60 | - 'key' => Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
|
| 61 | - 'value' => null, |
|
| 62 | - 'compare' => '!=', |
|
| 63 | - ), |
|
| 64 | - ), |
|
| 65 | - 'tax_query' => array( |
|
| 66 | - array( |
|
| 67 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 68 | - 'field' => 'slug', |
|
| 69 | - 'terms' => 'place', |
|
| 70 | - ), |
|
| 71 | - ), |
|
| 72 | - ) ); |
|
| 44 | + // Retrieve all 'published' places with geo coordinates defined |
|
| 45 | + // If $related_ids is not empty, it's used to limit query results to the current post related places |
|
| 46 | + // Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query |
|
| 47 | + return get_posts( array( |
|
| 48 | + 'post__in' => $related_ids, |
|
| 49 | + 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 50 | + 'nopaging' => true, |
|
| 51 | + 'post_status' => 'publish', |
|
| 52 | + 'meta_query' => array( |
|
| 53 | + 'relation' => 'AND', |
|
| 54 | + array( |
|
| 55 | + 'key' => Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
|
| 56 | + 'value' => null, |
|
| 57 | + 'compare' => '!=', |
|
| 58 | + ), |
|
| 59 | + array( |
|
| 60 | + 'key' => Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
|
| 61 | + 'value' => null, |
|
| 62 | + 'compare' => '!=', |
|
| 63 | + ), |
|
| 64 | + ), |
|
| 65 | + 'tax_query' => array( |
|
| 66 | + array( |
|
| 67 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 68 | + 'field' => 'slug', |
|
| 69 | + 'terms' => 'place', |
|
| 70 | + ), |
|
| 71 | + ), |
|
| 72 | + ) ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -84,91 +84,91 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | function wl_shortcode_geomap_prepare_map( $places ) { |
| 86 | 86 | |
| 87 | - // Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript. |
|
| 88 | - $min_latitude = PHP_INT_MAX; |
|
| 89 | - $min_longitude = PHP_INT_MAX; |
|
| 90 | - $max_latitude = ~PHP_INT_MAX; |
|
| 91 | - $max_longitude = ~PHP_INT_MAX; |
|
| 87 | + // Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript. |
|
| 88 | + $min_latitude = PHP_INT_MAX; |
|
| 89 | + $min_longitude = PHP_INT_MAX; |
|
| 90 | + $max_latitude = ~PHP_INT_MAX; |
|
| 91 | + $max_longitude = ~PHP_INT_MAX; |
|
| 92 | 92 | |
| 93 | - // Prepare an empty array of POIs in geoJSON format. |
|
| 94 | - $pois = array(); |
|
| 95 | - // And store list of points to allow Leaflet compute the optimal bounding box. |
|
| 96 | - // The main reason for this is that geoJSON has swapped coordinates (lon. lat) |
|
| 97 | - $boundaries = array(); |
|
| 93 | + // Prepare an empty array of POIs in geoJSON format. |
|
| 94 | + $pois = array(); |
|
| 95 | + // And store list of points to allow Leaflet compute the optimal bounding box. |
|
| 96 | + // The main reason for this is that geoJSON has swapped coordinates (lon. lat) |
|
| 97 | + $boundaries = array(); |
|
| 98 | 98 | |
| 99 | - // Add a POI for each entity that has coordinates. |
|
| 100 | - foreach ( $places as $entity ) { |
|
| 99 | + // Add a POI for each entity that has coordinates. |
|
| 100 | + foreach ( $places as $entity ) { |
|
| 101 | 101 | |
| 102 | - // Get the coordinates. |
|
| 103 | - $coordinates = wl_get_coordinates( $entity->ID ); |
|
| 102 | + // Get the coordinates. |
|
| 103 | + $coordinates = wl_get_coordinates( $entity->ID ); |
|
| 104 | 104 | |
| 105 | - // Don't show the widget if the coordinates aren't set. |
|
| 106 | - if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) { |
|
| 107 | - continue; |
|
| 108 | - } |
|
| 105 | + // Don't show the widget if the coordinates aren't set. |
|
| 106 | + if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) { |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - // TODO Map html rendering should be delegated to the wordlift js ui layer |
|
| 111 | - // This function should be focused on returning pure data instead |
|
| 110 | + // TODO Map html rendering should be delegated to the wordlift js ui layer |
|
| 111 | + // This function should be focused on returning pure data instead |
|
| 112 | 112 | |
| 113 | - // Get the title, URL and thumb of the entity. |
|
| 114 | - $title = esc_attr( $entity->post_title ); |
|
| 115 | - $link = esc_attr( get_permalink( $entity->ID ) ); |
|
| 116 | - if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) && |
|
| 117 | - false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) ) |
|
| 118 | - ) { |
|
| 119 | - $img_src = esc_attr( $attachment[0] ); |
|
| 120 | - } |
|
| 113 | + // Get the title, URL and thumb of the entity. |
|
| 114 | + $title = esc_attr( $entity->post_title ); |
|
| 115 | + $link = esc_attr( get_permalink( $entity->ID ) ); |
|
| 116 | + if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) && |
|
| 117 | + false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) ) |
|
| 118 | + ) { |
|
| 119 | + $img_src = esc_attr( $attachment[0] ); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - // Build HTML popup. TODO: move thumb width in css |
|
| 123 | - $content = "<a href=$link><h6>$title</h6>"; |
|
| 124 | - if ( isset( $img_src ) ) { |
|
| 125 | - $content = $content . "<img src=$img_src style='width:100%'/>"; |
|
| 126 | - } |
|
| 127 | - $content = $content . "</a><ul>"; |
|
| 128 | - // Get the related posts (published) and print them in the popup. |
|
| 129 | - $related_posts = wl_core_get_related_post_ids( $entity->ID, array( |
|
| 130 | - 'status' => 'publish', |
|
| 131 | - ) ); |
|
| 132 | - foreach ( $related_posts as $rp_id ) { |
|
| 122 | + // Build HTML popup. TODO: move thumb width in css |
|
| 123 | + $content = "<a href=$link><h6>$title</h6>"; |
|
| 124 | + if ( isset( $img_src ) ) { |
|
| 125 | + $content = $content . "<img src=$img_src style='width:100%'/>"; |
|
| 126 | + } |
|
| 127 | + $content = $content . "</a><ul>"; |
|
| 128 | + // Get the related posts (published) and print them in the popup. |
|
| 129 | + $related_posts = wl_core_get_related_post_ids( $entity->ID, array( |
|
| 130 | + 'status' => 'publish', |
|
| 131 | + ) ); |
|
| 132 | + foreach ( $related_posts as $rp_id ) { |
|
| 133 | 133 | |
| 134 | - $rp = get_post( $rp_id ); |
|
| 135 | - $title = esc_attr( $rp->post_title ); |
|
| 136 | - $link = esc_attr( get_permalink( $rp->ID ) ); |
|
| 137 | - $content = $content . "<li><a href=$link>$title</a></li>"; |
|
| 138 | - } |
|
| 139 | - $content = $content . "</ul>"; |
|
| 134 | + $rp = get_post( $rp_id ); |
|
| 135 | + $title = esc_attr( $rp->post_title ); |
|
| 136 | + $link = esc_attr( get_permalink( $rp->ID ) ); |
|
| 137 | + $content = $content . "<li><a href=$link>$title</a></li>"; |
|
| 138 | + } |
|
| 139 | + $content = $content . "</ul>"; |
|
| 140 | 140 | |
| 141 | - // Formatting POI in geoJSON. |
|
| 142 | - // http://leafletjs.com/examples/geojson.html |
|
| 143 | - $poi = array( |
|
| 144 | - 'type' => 'Feature', |
|
| 145 | - 'properties' => array( 'popupContent' => $content ), |
|
| 146 | - 'geometry' => array( |
|
| 147 | - 'type' => 'Point', |
|
| 148 | - 'coordinates' => array( |
|
| 149 | - // Leaflet geoJSON wants them swapped |
|
| 150 | - $coordinates['longitude'], |
|
| 151 | - $coordinates['latitude'], |
|
| 152 | - ), |
|
| 153 | - ), |
|
| 154 | - ); |
|
| 141 | + // Formatting POI in geoJSON. |
|
| 142 | + // http://leafletjs.com/examples/geojson.html |
|
| 143 | + $poi = array( |
|
| 144 | + 'type' => 'Feature', |
|
| 145 | + 'properties' => array( 'popupContent' => $content ), |
|
| 146 | + 'geometry' => array( |
|
| 147 | + 'type' => 'Point', |
|
| 148 | + 'coordinates' => array( |
|
| 149 | + // Leaflet geoJSON wants them swapped |
|
| 150 | + $coordinates['longitude'], |
|
| 151 | + $coordinates['latitude'], |
|
| 152 | + ), |
|
| 153 | + ), |
|
| 154 | + ); |
|
| 155 | 155 | |
| 156 | - $pois[] = $poi; |
|
| 156 | + $pois[] = $poi; |
|
| 157 | 157 | |
| 158 | - // Formatting boundaries in a Leaflet-like format (see LatLngBounds). |
|
| 159 | - // http://leafletjs.com/reference.html#latlngbounds |
|
| 160 | - $boundaries[] = array( |
|
| 161 | - $coordinates['latitude'], |
|
| 162 | - $coordinates['longitude'], |
|
| 163 | - ); |
|
| 158 | + // Formatting boundaries in a Leaflet-like format (see LatLngBounds). |
|
| 159 | + // http://leafletjs.com/reference.html#latlngbounds |
|
| 160 | + $boundaries[] = array( |
|
| 161 | + $coordinates['latitude'], |
|
| 162 | + $coordinates['longitude'], |
|
| 163 | + ); |
|
| 164 | 164 | |
| 165 | - } |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - $map_data = array(); |
|
| 168 | - $map_data['features'] = $pois; |
|
| 169 | - $map_data['boundaries'] = $boundaries; |
|
| 167 | + $map_data = array(); |
|
| 168 | + $map_data['features'] = $pois; |
|
| 169 | + $map_data['boundaries'] = $boundaries; |
|
| 170 | 170 | |
| 171 | - return $map_data; |
|
| 171 | + return $map_data; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | * @return array An array of place posts. |
| 183 | 183 | */ |
| 184 | 184 | function wl_shortcode_geomap_ajax() { |
| 185 | - // Get the post Id. |
|
| 186 | - $post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null ); |
|
| 185 | + // Get the post Id. |
|
| 186 | + $post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null ); |
|
| 187 | 187 | |
| 188 | - $places = wl_shortcode_geomap_get_places( $post_id ); |
|
| 189 | - $map_data = wl_shortcode_geomap_prepare_map( $places ); |
|
| 188 | + $places = wl_shortcode_geomap_get_places( $post_id ); |
|
| 189 | + $map_data = wl_shortcode_geomap_prepare_map( $places ); |
|
| 190 | 190 | |
| 191 | - wl_core_send_json( $map_data ); |
|
| 191 | + wl_core_send_json( $map_data ); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | add_action( 'wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax' ); |
@@ -199,35 +199,35 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | add_action( 'init', function() { |
| 201 | 201 | |
| 202 | - // Bail out if the `register_block_type` function isn't available. |
|
| 203 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 204 | - return; |
|
| 205 | - } |
|
| 202 | + // Bail out if the `register_block_type` function isn't available. |
|
| 203 | + if ( ! function_exists( 'register_block_type' ) ) { |
|
| 204 | + return; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - register_block_type('wordlift/geomap', array( |
|
| 208 | - 'editor_script' => 'wl-block-editor', |
|
| 209 | - 'render_callback' => function($attributes){ |
|
| 210 | - $attr_code = ''; |
|
| 211 | - foreach ($attributes as $key => $value) { |
|
| 212 | - $attr_code .= $key.'="'.$value.'" '; |
|
| 213 | - } |
|
| 214 | - return '[wl_geomap '.$attr_code.']'; |
|
| 215 | - }, |
|
| 216 | - 'attributes' => array( |
|
| 217 | - 'width' => array( |
|
| 218 | - 'type' => 'string', |
|
| 219 | - 'default' => '100%' |
|
| 220 | - ), |
|
| 221 | - 'height' => array( |
|
| 222 | - 'type' => 'string', |
|
| 223 | - 'default' => '300px' |
|
| 224 | - ), |
|
| 225 | - 'global' => array( |
|
| 226 | - 'type' => 'bool', |
|
| 227 | - 'default' => false |
|
| 228 | - ), |
|
| 229 | - ) |
|
| 230 | - )); |
|
| 207 | + register_block_type('wordlift/geomap', array( |
|
| 208 | + 'editor_script' => 'wl-block-editor', |
|
| 209 | + 'render_callback' => function($attributes){ |
|
| 210 | + $attr_code = ''; |
|
| 211 | + foreach ($attributes as $key => $value) { |
|
| 212 | + $attr_code .= $key.'="'.$value.'" '; |
|
| 213 | + } |
|
| 214 | + return '[wl_geomap '.$attr_code.']'; |
|
| 215 | + }, |
|
| 216 | + 'attributes' => array( |
|
| 217 | + 'width' => array( |
|
| 218 | + 'type' => 'string', |
|
| 219 | + 'default' => '100%' |
|
| 220 | + ), |
|
| 221 | + 'height' => array( |
|
| 222 | + 'type' => 'string', |
|
| 223 | + 'default' => '300px' |
|
| 224 | + ), |
|
| 225 | + 'global' => array( |
|
| 226 | + 'type' => 'bool', |
|
| 227 | + 'default' => false |
|
| 228 | + ), |
|
| 229 | + ) |
|
| 230 | + )); |
|
| 231 | 231 | } ); |
| 232 | 232 | |
| 233 | 233 | ///** |
@@ -16,35 +16,35 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return array An array of place posts. |
| 18 | 18 | */ |
| 19 | -function wl_shortcode_geomap_get_places( $post_id = null ) { |
|
| 19 | +function wl_shortcode_geomap_get_places($post_id = null) { |
|
| 20 | 20 | |
| 21 | 21 | // If $post_id is null or is not numeric it means this is a global geomap |
| 22 | - $is_global = is_null( $post_id ) || ! is_numeric( $post_id ); |
|
| 22 | + $is_global = is_null($post_id) || ! is_numeric($post_id); |
|
| 23 | 23 | |
| 24 | 24 | // If the current one is not a global geomap, retrieve related entities ids |
| 25 | - if ( $is_global ) { |
|
| 25 | + if ($is_global) { |
|
| 26 | 26 | $related_ids = array(); |
| 27 | 27 | } else { |
| 28 | - $related_ids = wl_core_get_related_entity_ids( $post_id, array( |
|
| 28 | + $related_ids = wl_core_get_related_entity_ids($post_id, array( |
|
| 29 | 29 | 'status' => 'publish', |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | 32 | // Also include current entity |
| 33 | - if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) { |
|
| 33 | + if (Wordlift_Entity_Service::get_instance()->is_entity($post_id)) { |
|
| 34 | 34 | $related_ids[] = $post_id; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // If is not a global geomap, an empty $related_ids means that no entities are related to the post |
| 39 | 39 | // An empty array can be returned in this case |
| 40 | - if ( ! $is_global && empty( $related_ids ) ) { |
|
| 40 | + if ( ! $is_global && empty($related_ids)) { |
|
| 41 | 41 | return array(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Retrieve all 'published' places with geo coordinates defined |
| 45 | 45 | // If $related_ids is not empty, it's used to limit query results to the current post related places |
| 46 | 46 | // Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query |
| 47 | - return get_posts( array( |
|
| 47 | + return get_posts(array( |
|
| 48 | 48 | 'post__in' => $related_ids, |
| 49 | 49 | 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
| 50 | 50 | 'nopaging' => true, |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | 'terms' => 'place', |
| 70 | 70 | ), |
| 71 | 71 | ), |
| 72 | - ) ); |
|
| 72 | + )); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return array An array of markers and boundaries for Leaflet. |
| 84 | 84 | */ |
| 85 | -function wl_shortcode_geomap_prepare_map( $places ) { |
|
| 85 | +function wl_shortcode_geomap_prepare_map($places) { |
|
| 86 | 86 | |
| 87 | 87 | // Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript. |
| 88 | 88 | $min_latitude = PHP_INT_MAX; |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | $boundaries = array(); |
| 98 | 98 | |
| 99 | 99 | // Add a POI for each entity that has coordinates. |
| 100 | - foreach ( $places as $entity ) { |
|
| 100 | + foreach ($places as $entity) { |
|
| 101 | 101 | |
| 102 | 102 | // Get the coordinates. |
| 103 | - $coordinates = wl_get_coordinates( $entity->ID ); |
|
| 103 | + $coordinates = wl_get_coordinates($entity->ID); |
|
| 104 | 104 | |
| 105 | 105 | // Don't show the widget if the coordinates aren't set. |
| 106 | - if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) { |
|
| 106 | + if ($coordinates['latitude'] == 0 || $coordinates['longitude'] == 0) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -111,38 +111,38 @@ discard block |
||
| 111 | 111 | // This function should be focused on returning pure data instead |
| 112 | 112 | |
| 113 | 113 | // Get the title, URL and thumb of the entity. |
| 114 | - $title = esc_attr( $entity->post_title ); |
|
| 115 | - $link = esc_attr( get_permalink( $entity->ID ) ); |
|
| 116 | - if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) && |
|
| 117 | - false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) ) |
|
| 114 | + $title = esc_attr($entity->post_title); |
|
| 115 | + $link = esc_attr(get_permalink($entity->ID)); |
|
| 116 | + if ('' !== ($thumbnail_id = get_post_thumbnail_id($entity->ID)) && |
|
| 117 | + false !== ($attachment = wp_get_attachment_image_src($thumbnail_id)) |
|
| 118 | 118 | ) { |
| 119 | - $img_src = esc_attr( $attachment[0] ); |
|
| 119 | + $img_src = esc_attr($attachment[0]); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // Build HTML popup. TODO: move thumb width in css |
| 123 | 123 | $content = "<a href=$link><h6>$title</h6>"; |
| 124 | - if ( isset( $img_src ) ) { |
|
| 125 | - $content = $content . "<img src=$img_src style='width:100%'/>"; |
|
| 124 | + if (isset($img_src)) { |
|
| 125 | + $content = $content."<img src=$img_src style='width:100%'/>"; |
|
| 126 | 126 | } |
| 127 | - $content = $content . "</a><ul>"; |
|
| 127 | + $content = $content."</a><ul>"; |
|
| 128 | 128 | // Get the related posts (published) and print them in the popup. |
| 129 | - $related_posts = wl_core_get_related_post_ids( $entity->ID, array( |
|
| 129 | + $related_posts = wl_core_get_related_post_ids($entity->ID, array( |
|
| 130 | 130 | 'status' => 'publish', |
| 131 | - ) ); |
|
| 132 | - foreach ( $related_posts as $rp_id ) { |
|
| 131 | + )); |
|
| 132 | + foreach ($related_posts as $rp_id) { |
|
| 133 | 133 | |
| 134 | - $rp = get_post( $rp_id ); |
|
| 135 | - $title = esc_attr( $rp->post_title ); |
|
| 136 | - $link = esc_attr( get_permalink( $rp->ID ) ); |
|
| 137 | - $content = $content . "<li><a href=$link>$title</a></li>"; |
|
| 134 | + $rp = get_post($rp_id); |
|
| 135 | + $title = esc_attr($rp->post_title); |
|
| 136 | + $link = esc_attr(get_permalink($rp->ID)); |
|
| 137 | + $content = $content."<li><a href=$link>$title</a></li>"; |
|
| 138 | 138 | } |
| 139 | - $content = $content . "</ul>"; |
|
| 139 | + $content = $content."</ul>"; |
|
| 140 | 140 | |
| 141 | 141 | // Formatting POI in geoJSON. |
| 142 | 142 | // http://leafletjs.com/examples/geojson.html |
| 143 | 143 | $poi = array( |
| 144 | 144 | 'type' => 'Feature', |
| 145 | - 'properties' => array( 'popupContent' => $content ), |
|
| 145 | + 'properties' => array('popupContent' => $content), |
|
| 146 | 146 | 'geometry' => array( |
| 147 | 147 | 'type' => 'Point', |
| 148 | 148 | 'coordinates' => array( |
@@ -183,30 +183,30 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | function wl_shortcode_geomap_ajax() { |
| 185 | 185 | // Get the post Id. |
| 186 | - $post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null ); |
|
| 186 | + $post_id = (isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : null); |
|
| 187 | 187 | |
| 188 | - $places = wl_shortcode_geomap_get_places( $post_id ); |
|
| 189 | - $map_data = wl_shortcode_geomap_prepare_map( $places ); |
|
| 188 | + $places = wl_shortcode_geomap_get_places($post_id); |
|
| 189 | + $map_data = wl_shortcode_geomap_prepare_map($places); |
|
| 190 | 190 | |
| 191 | - wl_core_send_json( $map_data ); |
|
| 191 | + wl_core_send_json($map_data); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | -add_action( 'wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax' ); |
|
| 195 | -add_action( 'wp_ajax_nopriv_wl_geomap', 'wl_shortcode_geomap_ajax' ); |
|
| 194 | +add_action('wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax'); |
|
| 195 | +add_action('wp_ajax_nopriv_wl_geomap', 'wl_shortcode_geomap_ajax'); |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * register_block_type for Gutenberg blocks |
| 199 | 199 | */ |
| 200 | -add_action( 'init', function() { |
|
| 200 | +add_action('init', function() { |
|
| 201 | 201 | |
| 202 | 202 | // Bail out if the `register_block_type` function isn't available. |
| 203 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 203 | + if ( ! function_exists('register_block_type')) { |
|
| 204 | 204 | return; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | register_block_type('wordlift/geomap', array( |
| 208 | 208 | 'editor_script' => 'wl-block-editor', |
| 209 | - 'render_callback' => function($attributes){ |
|
| 209 | + 'render_callback' => function($attributes) { |
|
| 210 | 210 | $attr_code = ''; |
| 211 | 211 | foreach ($attributes as $key => $value) { |
| 212 | 212 | $attr_code .= $key.'="'.$value.'" '; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class WL_Metabox_Field_coordinates extends WL_Metabox_Field { |
| 5 | 5 | |
| 6 | - public function __construct( $args ) { |
|
| 6 | + public function __construct($args) { |
|
| 7 | 7 | |
| 8 | 8 | // Just set up the necessary info without calling the parent constructor. |
| 9 | 9 | // TODO: write a parent class for grouped properties |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function get_data() { |
| 17 | 17 | $entity_id = get_the_ID(); |
| 18 | - $this->data = wl_get_coordinates( $entity_id ); |
|
| 18 | + $this->data = wl_get_coordinates($entity_id); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function html() { |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | $data = $this->data; |
| 34 | 34 | // TODO: We temporary use here 0,0 as default coordinates for the marker, but if no coordinates are given we |
| 35 | 35 | // want to use the current user location for the marker. |
| 36 | - $coordinates = ( ! empty( $data['latitude'] ) && ! empty( $data['longitude'] ) ? sprintf( '[%f,%f]', $data['latitude'], $data['longitude'] ) : '[0,0]' ); |
|
| 36 | + $coordinates = ( ! empty($data['latitude']) && ! empty($data['longitude']) ? sprintf('[%f,%f]', $data['latitude'], $data['longitude']) : '[0,0]'); |
|
| 37 | 37 | $map_init = '[0,0]' === $coordinates |
| 38 | 38 | ? 'locate( {setView: true, maxZoom: 16} )' |
| 39 | - : sprintf( "setView( [%f,%f], 9 )", $data['latitude'], $data['longitude'] ); |
|
| 39 | + : sprintf("setView( [%f,%f], 9 )", $data['latitude'], $data['longitude']); |
|
| 40 | 40 | |
| 41 | 41 | // Print input fields |
| 42 | - $html .= '<label for="wl_place_lat">' . __( 'Latitude', 'wordlift' ) . '</label>'; |
|
| 43 | - $html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="' . $data['latitude'] . '" style="width:100%" />'; |
|
| 42 | + $html .= '<label for="wl_place_lat">'.__('Latitude', 'wordlift').'</label>'; |
|
| 43 | + $html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="'.$data['latitude'].'" style="width:100%" />'; |
|
| 44 | 44 | |
| 45 | - $html .= '<label for="wl_place_lon">' . __( 'Longitude', 'wordlift' ) . '</label>'; |
|
| 46 | - $html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="' . $data['longitude'] . '" style="width:100%" />'; |
|
| 45 | + $html .= '<label for="wl_place_lon">'.__('Longitude', 'wordlift').'</label>'; |
|
| 46 | + $html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="'.$data['longitude'].'" style="width:100%" />'; |
|
| 47 | 47 | |
| 48 | 48 | // Show Leaflet map to pick coordinates |
| 49 | - $element_id = uniqid( 'wl-gep-map-' ); |
|
| 49 | + $element_id = uniqid('wl-gep-map-'); |
|
| 50 | 50 | $html .= <<<EOF |
| 51 | 51 | |
| 52 | 52 | <div id="$element_id"></div> |
@@ -84,23 +84,23 @@ discard block |
||
| 84 | 84 | return $html; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function save_data( $coords ) { |
|
| 87 | + public function save_data($coords) { |
|
| 88 | 88 | |
| 89 | - $this->sanitize_data( $coords ); |
|
| 89 | + $this->sanitize_data($coords); |
|
| 90 | 90 | |
| 91 | 91 | $entity_id = get_the_ID(); |
| 92 | 92 | |
| 93 | 93 | // Take away old values |
| 94 | - delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE ); |
|
| 95 | - delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE ); |
|
| 94 | + delete_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE); |
|
| 95 | + delete_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE); |
|
| 96 | 96 | |
| 97 | 97 | $latitude = $this->data[0]; |
| 98 | 98 | $longitude = $this->data[1]; |
| 99 | 99 | |
| 100 | 100 | // insert new coordinate values |
| 101 | - if ( ! empty( $latitude ) && ! empty( $longitude ) ) { |
|
| 102 | - add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true ); |
|
| 103 | - add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true ); |
|
| 101 | + if ( ! empty($latitude) && ! empty($longitude)) { |
|
| 102 | + add_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true); |
|
| 103 | + add_post_meta($entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | } |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Only accept float numbers |
| 110 | 110 | */ |
| 111 | - public function sanitize_data_filter( $value ) { |
|
| 111 | + public function sanitize_data_filter($value) { |
|
| 112 | 112 | |
| 113 | 113 | // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
| 114 | 114 | // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
| 115 | - if ( ! is_numeric( $value ) ) { |
|
| 115 | + if ( ! is_numeric($value)) { |
|
| 116 | 116 | return ''; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -3,51 +3,51 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class WL_Metabox_Field_coordinates extends WL_Metabox_Field { |
| 5 | 5 | |
| 6 | - public function __construct( $args ) { |
|
| 6 | + public function __construct( $args ) { |
|
| 7 | 7 | |
| 8 | - // Just set up the necessary info without calling the parent constructor. |
|
| 9 | - // TODO: write a parent class for grouped properties |
|
| 8 | + // Just set up the necessary info without calling the parent constructor. |
|
| 9 | + // TODO: write a parent class for grouped properties |
|
| 10 | 10 | |
| 11 | - // we use 'coordinates' to namespace the Field in $_POST data. |
|
| 12 | - // In the DB the correct meta names will be used. |
|
| 13 | - $this->meta_name = 'coordinates'; |
|
| 14 | - } |
|
| 11 | + // we use 'coordinates' to namespace the Field in $_POST data. |
|
| 12 | + // In the DB the correct meta names will be used. |
|
| 13 | + $this->meta_name = 'coordinates'; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function get_data() { |
|
| 17 | - $entity_id = get_the_ID(); |
|
| 18 | - $this->data = wl_get_coordinates( $entity_id ); |
|
| 19 | - } |
|
| 16 | + public function get_data() { |
|
| 17 | + $entity_id = get_the_ID(); |
|
| 18 | + $this->data = wl_get_coordinates( $entity_id ); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function html() { |
|
| 21 | + public function html() { |
|
| 22 | 22 | |
| 23 | - // Open main <div> for the Field |
|
| 24 | - $html = $this->html_wrapper_open(); |
|
| 23 | + // Open main <div> for the Field |
|
| 24 | + $html = $this->html_wrapper_open(); |
|
| 25 | 25 | |
| 26 | - // Label |
|
| 27 | - $html .= '<h3>coordinates</h3>'; |
|
| 26 | + // Label |
|
| 27 | + $html .= '<h3>coordinates</h3>'; |
|
| 28 | 28 | |
| 29 | - // print nonce |
|
| 30 | - $html .= $this->html_nonce(); |
|
| 29 | + // print nonce |
|
| 30 | + $html .= $this->html_nonce(); |
|
| 31 | 31 | |
| 32 | - // Get coordinates |
|
| 33 | - $data = $this->data; |
|
| 34 | - // TODO: We temporary use here 0,0 as default coordinates for the marker, but if no coordinates are given we |
|
| 35 | - // want to use the current user location for the marker. |
|
| 36 | - $coordinates = ( ! empty( $data['latitude'] ) && ! empty( $data['longitude'] ) ? sprintf( '[%f,%f]', $data['latitude'], $data['longitude'] ) : '[0,0]' ); |
|
| 37 | - $map_init = '[0,0]' === $coordinates |
|
| 38 | - ? 'locate( {setView: true, maxZoom: 16} )' |
|
| 39 | - : sprintf( "setView( [%f,%f], 9 )", $data['latitude'], $data['longitude'] ); |
|
| 32 | + // Get coordinates |
|
| 33 | + $data = $this->data; |
|
| 34 | + // TODO: We temporary use here 0,0 as default coordinates for the marker, but if no coordinates are given we |
|
| 35 | + // want to use the current user location for the marker. |
|
| 36 | + $coordinates = ( ! empty( $data['latitude'] ) && ! empty( $data['longitude'] ) ? sprintf( '[%f,%f]', $data['latitude'], $data['longitude'] ) : '[0,0]' ); |
|
| 37 | + $map_init = '[0,0]' === $coordinates |
|
| 38 | + ? 'locate( {setView: true, maxZoom: 16} )' |
|
| 39 | + : sprintf( "setView( [%f,%f], 9 )", $data['latitude'], $data['longitude'] ); |
|
| 40 | 40 | |
| 41 | - // Print input fields |
|
| 42 | - $html .= '<label for="wl_place_lat">' . __( 'Latitude', 'wordlift' ) . '</label>'; |
|
| 43 | - $html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="' . $data['latitude'] . '" style="width:100%" />'; |
|
| 41 | + // Print input fields |
|
| 42 | + $html .= '<label for="wl_place_lat">' . __( 'Latitude', 'wordlift' ) . '</label>'; |
|
| 43 | + $html .= '<input type="text" id="wl_place_lat" name="wl_metaboxes[coordinates][]" value="' . $data['latitude'] . '" style="width:100%" />'; |
|
| 44 | 44 | |
| 45 | - $html .= '<label for="wl_place_lon">' . __( 'Longitude', 'wordlift' ) . '</label>'; |
|
| 46 | - $html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="' . $data['longitude'] . '" style="width:100%" />'; |
|
| 45 | + $html .= '<label for="wl_place_lon">' . __( 'Longitude', 'wordlift' ) . '</label>'; |
|
| 46 | + $html .= '<input type="text" id="wl_place_lon" name="wl_metaboxes[coordinates][]" value="' . $data['longitude'] . '" style="width:100%" />'; |
|
| 47 | 47 | |
| 48 | - // Show Leaflet map to pick coordinates |
|
| 49 | - $element_id = uniqid( 'wl-gep-map-' ); |
|
| 50 | - $html .= <<<EOF |
|
| 48 | + // Show Leaflet map to pick coordinates |
|
| 49 | + $element_id = uniqid( 'wl-gep-map-' ); |
|
| 50 | + $html .= <<<EOF |
|
| 51 | 51 | |
| 52 | 52 | <div id="$element_id"></div> |
| 53 | 53 | |
@@ -79,44 +79,44 @@ discard block |
||
| 79 | 79 | EOF; |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - $html .= $this->html_wrapper_close(); |
|
| 82 | + $html .= $this->html_wrapper_close(); |
|
| 83 | 83 | |
| 84 | - return $html; |
|
| 85 | - } |
|
| 84 | + return $html; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - public function save_data( $coords ) { |
|
| 87 | + public function save_data( $coords ) { |
|
| 88 | 88 | |
| 89 | - $this->sanitize_data( $coords ); |
|
| 89 | + $this->sanitize_data( $coords ); |
|
| 90 | 90 | |
| 91 | - $entity_id = get_the_ID(); |
|
| 91 | + $entity_id = get_the_ID(); |
|
| 92 | 92 | |
| 93 | - // Take away old values |
|
| 94 | - delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE ); |
|
| 95 | - delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE ); |
|
| 93 | + // Take away old values |
|
| 94 | + delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE ); |
|
| 95 | + delete_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE ); |
|
| 96 | 96 | |
| 97 | - $latitude = $this->data[0]; |
|
| 98 | - $longitude = $this->data[1]; |
|
| 97 | + $latitude = $this->data[0]; |
|
| 98 | + $longitude = $this->data[1]; |
|
| 99 | 99 | |
| 100 | - // insert new coordinate values |
|
| 101 | - if ( ! empty( $latitude ) && ! empty( $longitude ) ) { |
|
| 102 | - add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true ); |
|
| 103 | - add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true ); |
|
| 104 | - } |
|
| 100 | + // insert new coordinate values |
|
| 101 | + if ( ! empty( $latitude ) && ! empty( $longitude ) ) { |
|
| 102 | + add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LATITUDE, $latitude, true ); |
|
| 103 | + add_post_meta( $entity_id, Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, $longitude, true ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Only accept float numbers |
|
| 110 | - */ |
|
| 111 | - public function sanitize_data_filter( $value ) { |
|
| 108 | + /** |
|
| 109 | + * Only accept float numbers |
|
| 110 | + */ |
|
| 111 | + public function sanitize_data_filter( $value ) { |
|
| 112 | 112 | |
| 113 | - // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
|
| 114 | - // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 115 | - if ( ! is_numeric( $value ) ) { |
|
| 116 | - return ''; |
|
| 117 | - } |
|
| 113 | + // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
|
| 114 | + // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 115 | + if ( ! is_numeric( $value ) ) { |
|
| 116 | + return ''; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - return $value; |
|
| 120 | - } |
|
| 119 | + return $value; |
|
| 120 | + } |
|
| 121 | 121 | } |
| 122 | 122 | |
@@ -26,38 +26,38 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Wordlift_i18n { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * The domain specified for this plugin. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - * @access private |
|
| 34 | - * @var string $domain The domain identifier for this plugin. |
|
| 35 | - */ |
|
| 36 | - private $domain; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Load the plugin text domain for translation. |
|
| 40 | - * |
|
| 41 | - * @since 1.0.0 |
|
| 42 | - */ |
|
| 43 | - public function load_plugin_textdomain() { |
|
| 44 | - |
|
| 45 | - load_plugin_textdomain( |
|
| 46 | - $this->domain, |
|
| 47 | - false, |
|
| 48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 49 | - ); |
|
| 50 | - |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Set the domain equal to that of the specified domain. |
|
| 55 | - * |
|
| 56 | - * @since 1.0.0 |
|
| 57 | - * @param string $domain The domain that represents the locale of this plugin. |
|
| 58 | - */ |
|
| 59 | - public function set_domain( $domain ) { |
|
| 60 | - $this->domain = $domain; |
|
| 61 | - } |
|
| 29 | + /** |
|
| 30 | + * The domain specified for this plugin. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + * @access private |
|
| 34 | + * @var string $domain The domain identifier for this plugin. |
|
| 35 | + */ |
|
| 36 | + private $domain; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Load the plugin text domain for translation. |
|
| 40 | + * |
|
| 41 | + * @since 1.0.0 |
|
| 42 | + */ |
|
| 43 | + public function load_plugin_textdomain() { |
|
| 44 | + |
|
| 45 | + load_plugin_textdomain( |
|
| 46 | + $this->domain, |
|
| 47 | + false, |
|
| 48 | + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 49 | + ); |
|
| 50 | + |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Set the domain equal to that of the specified domain. |
|
| 55 | + * |
|
| 56 | + * @since 1.0.0 |
|
| 57 | + * @param string $domain The domain that represents the locale of this plugin. |
|
| 58 | + */ |
|
| 59 | + public function set_domain( $domain ) { |
|
| 60 | + $this->domain = $domain; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | load_plugin_textdomain( |
| 46 | 46 | $this->domain, |
| 47 | 47 | false, |
| 48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 48 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @since 1.0.0 |
| 57 | 57 | * @param string $domain The domain that represents the locale of this plugin. |
| 58 | 58 | */ |
| 59 | - public function set_domain( $domain ) { |
|
| 59 | + public function set_domain($domain) { |
|
| 60 | 60 | $this->domain = $domain; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -23,107 +23,107 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Wordlift_Loader { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The array of actions registered with WordPress. |
|
| 28 | - * |
|
| 29 | - * @since 1.0.0 |
|
| 30 | - * @access protected |
|
| 31 | - * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
| 32 | - */ |
|
| 33 | - protected $actions; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * The array of filters registered with WordPress. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * @access protected |
|
| 40 | - * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
| 41 | - */ |
|
| 42 | - protected $filters; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Initialize the collections used to maintain the actions and filters. |
|
| 46 | - * |
|
| 47 | - * @since 1.0.0 |
|
| 48 | - */ |
|
| 49 | - public function __construct() { |
|
| 50 | - |
|
| 51 | - $this->actions = array(); |
|
| 52 | - $this->filters = array(); |
|
| 53 | - |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Add a new action to the collection to be registered with WordPress. |
|
| 58 | - * |
|
| 59 | - * @since 1.0.0 |
|
| 60 | - * @param string $hook The name of the WordPress action that is being registered. |
|
| 61 | - * @param object $component A reference to the instance of the object on which the action is defined. |
|
| 62 | - * @param string $callback The name of the function definition on the $component. |
|
| 63 | - * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
| 64 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
| 65 | - */ |
|
| 66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Add a new filter to the collection to be registered with WordPress. |
|
| 72 | - * |
|
| 73 | - * @since 1.0.0 |
|
| 74 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
| 75 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
| 76 | - * @param string $callback The name of the function definition on the $component. |
|
| 77 | - * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
| 78 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
| 79 | - */ |
|
| 80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * A utility function that is used to register the actions and hooks into a single |
|
| 86 | - * collection. |
|
| 87 | - * |
|
| 88 | - * @since 1.0.0 |
|
| 89 | - * @access private |
|
| 90 | - * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
| 91 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
| 92 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
| 93 | - * @param string $callback The name of the function definition on the $component. |
|
| 94 | - * @param int $priority The priority at which the function should be fired. |
|
| 95 | - * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
| 96 | - * @return array The collection of actions and filters registered with WordPress. |
|
| 97 | - */ |
|
| 98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 99 | - |
|
| 100 | - $hooks[] = array( |
|
| 101 | - 'hook' => $hook, |
|
| 102 | - 'component' => $component, |
|
| 103 | - 'callback' => $callback, |
|
| 104 | - 'priority' => $priority, |
|
| 105 | - 'accepted_args' => $accepted_args |
|
| 106 | - ); |
|
| 107 | - |
|
| 108 | - return $hooks; |
|
| 109 | - |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Register the filters and actions with WordPress. |
|
| 114 | - * |
|
| 115 | - * @since 1.0.0 |
|
| 116 | - */ |
|
| 117 | - public function run() { |
|
| 118 | - |
|
| 119 | - foreach ( $this->filters as $hook ) { |
|
| 120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - foreach ( $this->actions as $hook ) { |
|
| 124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - } |
|
| 26 | + /** |
|
| 27 | + * The array of actions registered with WordPress. |
|
| 28 | + * |
|
| 29 | + * @since 1.0.0 |
|
| 30 | + * @access protected |
|
| 31 | + * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
| 32 | + */ |
|
| 33 | + protected $actions; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * The array of filters registered with WordPress. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * @access protected |
|
| 40 | + * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
| 41 | + */ |
|
| 42 | + protected $filters; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Initialize the collections used to maintain the actions and filters. |
|
| 46 | + * |
|
| 47 | + * @since 1.0.0 |
|
| 48 | + */ |
|
| 49 | + public function __construct() { |
|
| 50 | + |
|
| 51 | + $this->actions = array(); |
|
| 52 | + $this->filters = array(); |
|
| 53 | + |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Add a new action to the collection to be registered with WordPress. |
|
| 58 | + * |
|
| 59 | + * @since 1.0.0 |
|
| 60 | + * @param string $hook The name of the WordPress action that is being registered. |
|
| 61 | + * @param object $component A reference to the instance of the object on which the action is defined. |
|
| 62 | + * @param string $callback The name of the function definition on the $component. |
|
| 63 | + * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
| 64 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
| 65 | + */ |
|
| 66 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 67 | + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Add a new filter to the collection to be registered with WordPress. |
|
| 72 | + * |
|
| 73 | + * @since 1.0.0 |
|
| 74 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
| 75 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
| 76 | + * @param string $callback The name of the function definition on the $component. |
|
| 77 | + * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
| 78 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
| 79 | + */ |
|
| 80 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 81 | + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * A utility function that is used to register the actions and hooks into a single |
|
| 86 | + * collection. |
|
| 87 | + * |
|
| 88 | + * @since 1.0.0 |
|
| 89 | + * @access private |
|
| 90 | + * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
| 91 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
| 92 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
| 93 | + * @param string $callback The name of the function definition on the $component. |
|
| 94 | + * @param int $priority The priority at which the function should be fired. |
|
| 95 | + * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
| 96 | + * @return array The collection of actions and filters registered with WordPress. |
|
| 97 | + */ |
|
| 98 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 99 | + |
|
| 100 | + $hooks[] = array( |
|
| 101 | + 'hook' => $hook, |
|
| 102 | + 'component' => $component, |
|
| 103 | + 'callback' => $callback, |
|
| 104 | + 'priority' => $priority, |
|
| 105 | + 'accepted_args' => $accepted_args |
|
| 106 | + ); |
|
| 107 | + |
|
| 108 | + return $hooks; |
|
| 109 | + |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Register the filters and actions with WordPress. |
|
| 114 | + * |
|
| 115 | + * @since 1.0.0 |
|
| 116 | + */ |
|
| 117 | + public function run() { |
|
| 118 | + |
|
| 119 | + foreach ( $this->filters as $hook ) { |
|
| 120 | + add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + foreach ( $this->actions as $hook ) { |
|
| 124 | + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | } |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 64 | 64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
| 65 | 65 | */ |
| 66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 66 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 67 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 78 | 78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
| 79 | 79 | */ |
| 80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 80 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 81 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
| 96 | 96 | * @return array The collection of actions and filters registered with WordPress. |
| 97 | 97 | */ |
| 98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 98 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
| 99 | 99 | |
| 100 | 100 | $hooks[] = array( |
| 101 | 101 | 'hook' => $hook, |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function run() { |
| 118 | 118 | |
| 119 | - foreach ( $this->filters as $hook ) { |
|
| 120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 119 | + foreach ($this->filters as $hook) { |
|
| 120 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - foreach ( $this->actions as $hook ) { |
|
| 124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 123 | + foreach ($this->actions as $hook) { |
|
| 124 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | } |
@@ -9,28 +9,28 @@ discard block |
||
| 9 | 9 | * @param array $atts An array of shortcode attributes. |
| 10 | 10 | * @return string A dom element with requested property value(s). |
| 11 | 11 | */ |
| 12 | -function wl_shortcode_field( $atts ) { |
|
| 12 | +function wl_shortcode_field($atts) { |
|
| 13 | 13 | |
| 14 | 14 | // Extract attributes and set default values. |
| 15 | - $field_atts = shortcode_atts( array( |
|
| 15 | + $field_atts = shortcode_atts(array( |
|
| 16 | 16 | 'id' => null, |
| 17 | 17 | 'name' => null |
| 18 | - ), $atts ); |
|
| 18 | + ), $atts); |
|
| 19 | 19 | |
| 20 | 20 | // Get id of the post |
| 21 | 21 | $entity_id = $field_atts['id']; |
| 22 | - if( is_null( $field_atts['id'] ) || !is_numeric( $field_atts['id'] ) ) { |
|
| 22 | + if (is_null($field_atts['id']) || ! is_numeric($field_atts['id'])) { |
|
| 23 | 23 | $entity_id = get_the_ID(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $property_name = $field_atts['name']; |
| 27 | - if( !is_null( $property_name ) ) { |
|
| 28 | - $values = wl_schema_get_value( $entity_id, $property_name ); |
|
| 27 | + if ( ! is_null($property_name)) { |
|
| 28 | + $values = wl_schema_get_value($entity_id, $property_name); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Return |
| 32 | - if( is_array( $values ) ) { |
|
| 33 | - return implode( ', ', $values ); |
|
| 32 | + if (is_array($values)) { |
|
| 33 | + return implode(', ', $values); |
|
| 34 | 34 | } else { |
| 35 | 35 | return null; |
| 36 | 36 | } |
@@ -40,5 +40,5 @@ discard block |
||
| 40 | 40 | add_shortcode('wl_field', 'wl_shortcode_field'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -add_action( 'init', 'wl_register_shortcode_field'); |
|
| 43 | +add_action('init', 'wl_register_shortcode_field'); |
|
| 44 | 44 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @param array $args |
| 28 | 28 | * @param array $instance |
| 29 | 29 | */ |
| 30 | - public function widget( $args, $instance ) |
|
| 30 | + public function widget($args, $instance) |
|
| 31 | 31 | { |
| 32 | 32 | // Get the widget's title. |
| 33 | 33 | $title = apply_filters('widget_title', $instance['title']); |
| 34 | 34 | |
| 35 | 35 | // Print the HTML output. |
| 36 | 36 | echo $args['before_widget']; |
| 37 | - if (!empty($title)) { |
|
| 38 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 37 | + if ( ! empty($title)) { |
|
| 38 | + echo $args['before_title'].$title.$args['after_title']; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Print the geomap shortcode |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | |
| 83 | 83 | $instance = array(); |
| 84 | - $instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : ''; |
|
| 84 | + $instance['title'] = ( ! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : ''; |
|
| 85 | 85 | |
| 86 | 86 | return $instance; |
| 87 | 87 | } |
@@ -7,80 +7,80 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_UI_Service { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * The button element HTML code. |
|
| 12 | - * |
|
| 13 | - * @since 3.2.0 |
|
| 14 | - */ |
|
| 15 | - const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>'; |
|
| 10 | + /** |
|
| 11 | + * The button element HTML code. |
|
| 12 | + * |
|
| 13 | + * @since 3.2.0 |
|
| 14 | + */ |
|
| 15 | + const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>'; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The template HTML code. |
|
| 19 | - * |
|
| 20 | - * @since 3.2.0 |
|
| 21 | - */ |
|
| 22 | - const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>'; |
|
| 17 | + /** |
|
| 18 | + * The template HTML code. |
|
| 19 | + * |
|
| 20 | + * @since 3.2.0 |
|
| 21 | + */ |
|
| 22 | + const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Get the button HTML. |
|
| 26 | - * |
|
| 27 | - * @since 3.2.0 |
|
| 28 | - * |
|
| 29 | - * @param string $element_id The button element id. |
|
| 30 | - * @param string $label The button (translated) label. |
|
| 31 | - * |
|
| 32 | - * @return string The button HTML code. |
|
| 33 | - */ |
|
| 34 | - public function get_button_html( $element_id, $label ) { |
|
| 24 | + /** |
|
| 25 | + * Get the button HTML. |
|
| 26 | + * |
|
| 27 | + * @since 3.2.0 |
|
| 28 | + * |
|
| 29 | + * @param string $element_id The button element id. |
|
| 30 | + * @param string $label The button (translated) label. |
|
| 31 | + * |
|
| 32 | + * @return string The button HTML code. |
|
| 33 | + */ |
|
| 34 | + public function get_button_html( $element_id, $label ) { |
|
| 35 | 35 | |
| 36 | - return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) ); |
|
| 37 | - } |
|
| 36 | + return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Echo the button HTML. |
|
| 41 | - * |
|
| 42 | - * @since 3.2.0 |
|
| 43 | - * |
|
| 44 | - * @param string $element_id The button element id. |
|
| 45 | - * @param string $label The button (translated) label. |
|
| 46 | - * |
|
| 47 | - * @return string The button HTML code. |
|
| 48 | - */ |
|
| 49 | - public function print_button( $element_id, $label ) { |
|
| 39 | + /** |
|
| 40 | + * Echo the button HTML. |
|
| 41 | + * |
|
| 42 | + * @since 3.2.0 |
|
| 43 | + * |
|
| 44 | + * @param string $element_id The button element id. |
|
| 45 | + * @param string $label The button (translated) label. |
|
| 46 | + * |
|
| 47 | + * @return string The button HTML code. |
|
| 48 | + */ |
|
| 49 | + public function print_button( $element_id, $label ) { |
|
| 50 | 50 | |
| 51 | - echo( $this->get_button_html( $element_id, $label ) ); |
|
| 51 | + echo( $this->get_button_html( $element_id, $label ) ); |
|
| 52 | 52 | |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the HTML code for a template tag. |
|
| 57 | - * |
|
| 58 | - * @since 3.2.0 |
|
| 59 | - * |
|
| 60 | - * @param string $element_id The element id. |
|
| 61 | - * @param string $body The element content. |
|
| 62 | - * |
|
| 63 | - * @return string The HTML code. |
|
| 64 | - */ |
|
| 65 | - public function get_template_html( $element_id, $body ) { |
|
| 55 | + /** |
|
| 56 | + * Get the HTML code for a template tag. |
|
| 57 | + * |
|
| 58 | + * @since 3.2.0 |
|
| 59 | + * |
|
| 60 | + * @param string $element_id The element id. |
|
| 61 | + * @param string $body The element content. |
|
| 62 | + * |
|
| 63 | + * @return string The HTML code. |
|
| 64 | + */ |
|
| 65 | + public function get_template_html( $element_id, $body ) { |
|
| 66 | 66 | |
| 67 | - return sprintf( self::TEMPLATE_HTML, $element_id, $body ); |
|
| 68 | - } |
|
| 67 | + return sprintf( self::TEMPLATE_HTML, $element_id, $body ); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Echo the HTML code for a template tag. |
|
| 72 | - * |
|
| 73 | - * @since 3.2.0 |
|
| 74 | - * |
|
| 75 | - * @param string $element_id The element id. |
|
| 76 | - * @param string $body The element content. |
|
| 77 | - * |
|
| 78 | - * @return string The HTML code. |
|
| 79 | - */ |
|
| 80 | - public function print_template( $element_id, $body ) { |
|
| 70 | + /** |
|
| 71 | + * Echo the HTML code for a template tag. |
|
| 72 | + * |
|
| 73 | + * @since 3.2.0 |
|
| 74 | + * |
|
| 75 | + * @param string $element_id The element id. |
|
| 76 | + * @param string $body The element content. |
|
| 77 | + * |
|
| 78 | + * @return string The HTML code. |
|
| 79 | + */ |
|
| 80 | + public function print_template( $element_id, $body ) { |
|
| 81 | 81 | |
| 82 | - echo( $this->get_template_html( $element_id, $body ) ); |
|
| 82 | + echo( $this->get_template_html( $element_id, $body ) ); |
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return string The button HTML code. |
| 33 | 33 | */ |
| 34 | - public function get_button_html( $element_id, $label ) { |
|
| 34 | + public function get_button_html($element_id, $label) { |
|
| 35 | 35 | |
| 36 | - return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) ); |
|
| 36 | + return sprintf(self::BUTTON_HTML, $element_id, esc_html($label)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string The button HTML code. |
| 48 | 48 | */ |
| 49 | - public function print_button( $element_id, $label ) { |
|
| 49 | + public function print_button($element_id, $label) { |
|
| 50 | 50 | |
| 51 | - echo( $this->get_button_html( $element_id, $label ) ); |
|
| 51 | + echo($this->get_button_html($element_id, $label)); |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string The HTML code. |
| 64 | 64 | */ |
| 65 | - public function get_template_html( $element_id, $body ) { |
|
| 65 | + public function get_template_html($element_id, $body) { |
|
| 66 | 66 | |
| 67 | - return sprintf( self::TEMPLATE_HTML, $element_id, $body ); |
|
| 67 | + return sprintf(self::TEMPLATE_HTML, $element_id, $body); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return string The HTML code. |
| 79 | 79 | */ |
| 80 | - public function print_template( $element_id, $body ) { |
|
| 80 | + public function print_template($element_id, $body) { |
|
| 81 | 81 | |
| 82 | - echo( $this->get_template_html( $element_id, $body ) ); |
|
| 82 | + echo($this->get_template_html($element_id, $body)); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
@@ -7,33 +7,33 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_PrimaShop_Adapter { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Create a Wordlift_PrimaShop_Adapter instance. |
|
| 12 | - * |
|
| 13 | - * @since 3.2.3 |
|
| 14 | - */ |
|
| 15 | - public function __construct() { |
|
| 10 | + /** |
|
| 11 | + * Create a Wordlift_PrimaShop_Adapter instance. |
|
| 12 | + * |
|
| 13 | + * @since 3.2.3 |
|
| 14 | + */ |
|
| 15 | + public function __construct() { |
|
| 16 | 16 | |
| 17 | - // Tell WP (and PrimaShop) that we support the *prima-layout-settings*. This will display the Content Settings |
|
| 18 | - // in the entity edit page. |
|
| 19 | - add_post_type_support( Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings' ); |
|
| 17 | + // Tell WP (and PrimaShop) that we support the *prima-layout-settings*. This will display the Content Settings |
|
| 18 | + // in the entity edit page. |
|
| 19 | + add_post_type_support( Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings' ); |
|
| 20 | 20 | |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Intercept the <em>prima_metabox_entity_header_args</em> filter and return what a call to the related <em>post</em> |
|
| 25 | - * would have returned. |
|
| 26 | - * |
|
| 27 | - * @since 3.2.3 |
|
| 28 | - * |
|
| 29 | - * @param array $meta The meta array. |
|
| 30 | - * @param string $ype The post type. |
|
| 31 | - * |
|
| 32 | - * @return array A meta array. |
|
| 33 | - */ |
|
| 34 | - function prima_metabox_entity_header_args( $meta, $ype ) { |
|
| 23 | + /** |
|
| 24 | + * Intercept the <em>prima_metabox_entity_header_args</em> filter and return what a call to the related <em>post</em> |
|
| 25 | + * would have returned. |
|
| 26 | + * |
|
| 27 | + * @since 3.2.3 |
|
| 28 | + * |
|
| 29 | + * @param array $meta The meta array. |
|
| 30 | + * @param string $ype The post type. |
|
| 31 | + * |
|
| 32 | + * @return array A meta array. |
|
| 33 | + */ |
|
| 34 | + function prima_metabox_entity_header_args( $meta, $ype ) { |
|
| 35 | 35 | |
| 36 | - return apply_filters( "prima_metabox_post_header_args", $meta, 'post' ); |
|
| 37 | - } |
|
| 36 | + return apply_filters( "prima_metabox_post_header_args", $meta, 'post' ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | // Tell WP (and PrimaShop) that we support the *prima-layout-settings*. This will display the Content Settings |
| 18 | 18 | // in the entity edit page. |
| 19 | - add_post_type_support( Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings' ); |
|
| 19 | + add_post_type_support(Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings'); |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return array A meta array. |
| 33 | 33 | */ |
| 34 | - function prima_metabox_entity_header_args( $meta, $ype ) { |
|
| 34 | + function prima_metabox_entity_header_args($meta, $ype) { |
|
| 35 | 35 | |
| 36 | - return apply_filters( "prima_metabox_post_header_args", $meta, 'post' ); |
|
| 36 | + return apply_filters("prima_metabox_post_header_args", $meta, 'post'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | } |
@@ -7,180 +7,180 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_Notice_Service { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * The template used to display notices. The <em>notice dismissible</em> style classes make this notice dismissible |
|
| 12 | - * on the WordPress UI (via a small X button on the right side of the notice). |
|
| 13 | - * |
|
| 14 | - * @since 3.2.0 |
|
| 15 | - */ |
|
| 16 | - const TEMPLATE = '<div class="wl-notice notice is-dismissible %s"><p>%s</p></div>'; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * The standard WordPress <em>update</em> style class. |
|
| 20 | - * |
|
| 21 | - * @since 3.2.0 |
|
| 22 | - */ |
|
| 23 | - const UPDATE = 'update'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * The standard WordPress <em>update-nag</em> style class. |
|
| 27 | - * |
|
| 28 | - * @since 3.2.0 |
|
| 29 | - */ |
|
| 30 | - const UPDATE_NAG = 'update-nag'; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * The standard WordPress <em>error</em> style class. |
|
| 34 | - * |
|
| 35 | - * @since 3.2.0 |
|
| 36 | - */ |
|
| 37 | - const ERROR = 'error'; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * A custom WordLift css style class used for WordLift suggestions. |
|
| 41 | - * |
|
| 42 | - * @since 3.3.0 |
|
| 43 | - */ |
|
| 44 | - const SUGGESTION = 'wl-suggestion'; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * The array of notices. |
|
| 48 | - * |
|
| 49 | - * @since 3.2.0 |
|
| 50 | - * @access private |
|
| 51 | - * @var array $notices The array of notices. |
|
| 52 | - */ |
|
| 53 | - private $notices = array(); |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * A singleton instance of the Notice service. |
|
| 57 | - * |
|
| 58 | - * @since 3.2.0 |
|
| 59 | - * @access private |
|
| 60 | - * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 61 | - */ |
|
| 62 | - private static $instance; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Create an instance of the Notice service. |
|
| 66 | - * |
|
| 67 | - * @since 3.2.0 |
|
| 68 | - */ |
|
| 69 | - public function __construct() { |
|
| 70 | - |
|
| 71 | - // Hook to be called when to display notices. |
|
| 72 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 73 | - |
|
| 74 | - self::$instance = $this; |
|
| 75 | - |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Get the singleton instance of the Notice service. |
|
| 80 | - * |
|
| 81 | - * @since 3.2.0 |
|
| 82 | - * @return \Wordlift_Notice_Service The singleton instance of the Notice service. |
|
| 83 | - */ |
|
| 84 | - public static function get_instance() { |
|
| 85 | - |
|
| 86 | - return self::$instance; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Add a notice. |
|
| 91 | - * |
|
| 92 | - * @since 3.2.0 |
|
| 93 | - * |
|
| 94 | - * @param string $class The css class. |
|
| 95 | - * @param string $message The message. |
|
| 96 | - */ |
|
| 97 | - public function add( $class, $message ) { |
|
| 98 | - |
|
| 99 | - $this->notices[] = sprintf( self::TEMPLATE, $class, $this->transform( $message ) ); |
|
| 100 | - |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Add an update notice (message with a white background and a green left border). |
|
| 105 | - * |
|
| 106 | - * @since 3.2.0 |
|
| 107 | - * |
|
| 108 | - * @param string $message The message to display. |
|
| 109 | - */ |
|
| 110 | - public function add_update( $message ) { |
|
| 111 | - |
|
| 112 | - $this->add( self::UPDATE, $message ); |
|
| 113 | - |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Add an update nag notice (message with a white background and a yellow left border). |
|
| 118 | - * |
|
| 119 | - * @since 3.2.0 |
|
| 120 | - * |
|
| 121 | - * @param string $message The message to display. |
|
| 122 | - */ |
|
| 123 | - public function add_update_nag( $message ) { |
|
| 124 | - |
|
| 125 | - $this->add( self::UPDATE_NAG, $message ); |
|
| 126 | - |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Add an error notice (message with a white background and a red left border). |
|
| 131 | - * |
|
| 132 | - * @since 3.2.0 |
|
| 133 | - * |
|
| 134 | - * @param string $message The message to display. |
|
| 135 | - */ |
|
| 136 | - public function add_error( $message ) { |
|
| 137 | - |
|
| 138 | - $this->add( self::ERROR, $message ); |
|
| 139 | - |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Add a suggestion notice (message with a white background and a WordLift brand colored left border). |
|
| 144 | - * |
|
| 145 | - * @since 3.3.0 |
|
| 146 | - * |
|
| 147 | - * @param string $message The message to display. |
|
| 148 | - */ |
|
| 149 | - public function add_suggestion( $message ) { |
|
| 150 | - |
|
| 151 | - $this->add( self::SUGGESTION, $message ); |
|
| 152 | - |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Print out the notices when the admin_notices action is called. |
|
| 157 | - * |
|
| 158 | - * @since 3.2.0 |
|
| 159 | - */ |
|
| 160 | - public function admin_notices() { |
|
| 161 | - |
|
| 162 | - foreach ( $this->notices as $notice ) { |
|
| 163 | - echo( $notice ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Transform message depending on message type. Return a string |
|
| 170 | - * |
|
| 171 | - * @since 3.3.0 |
|
| 172 | - * |
|
| 173 | - * @param string $message The message. |
|
| 174 | - */ |
|
| 175 | - private function transform( $message ) { |
|
| 176 | - |
|
| 177 | - switch ( gettype( $message ) ) { |
|
| 178 | - case 'array': |
|
| 179 | - return implode( $message, '<br />' ); |
|
| 180 | - default: |
|
| 181 | - return $message; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - } |
|
| 10 | + /** |
|
| 11 | + * The template used to display notices. The <em>notice dismissible</em> style classes make this notice dismissible |
|
| 12 | + * on the WordPress UI (via a small X button on the right side of the notice). |
|
| 13 | + * |
|
| 14 | + * @since 3.2.0 |
|
| 15 | + */ |
|
| 16 | + const TEMPLATE = '<div class="wl-notice notice is-dismissible %s"><p>%s</p></div>'; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * The standard WordPress <em>update</em> style class. |
|
| 20 | + * |
|
| 21 | + * @since 3.2.0 |
|
| 22 | + */ |
|
| 23 | + const UPDATE = 'update'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * The standard WordPress <em>update-nag</em> style class. |
|
| 27 | + * |
|
| 28 | + * @since 3.2.0 |
|
| 29 | + */ |
|
| 30 | + const UPDATE_NAG = 'update-nag'; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * The standard WordPress <em>error</em> style class. |
|
| 34 | + * |
|
| 35 | + * @since 3.2.0 |
|
| 36 | + */ |
|
| 37 | + const ERROR = 'error'; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * A custom WordLift css style class used for WordLift suggestions. |
|
| 41 | + * |
|
| 42 | + * @since 3.3.0 |
|
| 43 | + */ |
|
| 44 | + const SUGGESTION = 'wl-suggestion'; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * The array of notices. |
|
| 48 | + * |
|
| 49 | + * @since 3.2.0 |
|
| 50 | + * @access private |
|
| 51 | + * @var array $notices The array of notices. |
|
| 52 | + */ |
|
| 53 | + private $notices = array(); |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * A singleton instance of the Notice service. |
|
| 57 | + * |
|
| 58 | + * @since 3.2.0 |
|
| 59 | + * @access private |
|
| 60 | + * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 61 | + */ |
|
| 62 | + private static $instance; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Create an instance of the Notice service. |
|
| 66 | + * |
|
| 67 | + * @since 3.2.0 |
|
| 68 | + */ |
|
| 69 | + public function __construct() { |
|
| 70 | + |
|
| 71 | + // Hook to be called when to display notices. |
|
| 72 | + add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 73 | + |
|
| 74 | + self::$instance = $this; |
|
| 75 | + |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Get the singleton instance of the Notice service. |
|
| 80 | + * |
|
| 81 | + * @since 3.2.0 |
|
| 82 | + * @return \Wordlift_Notice_Service The singleton instance of the Notice service. |
|
| 83 | + */ |
|
| 84 | + public static function get_instance() { |
|
| 85 | + |
|
| 86 | + return self::$instance; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Add a notice. |
|
| 91 | + * |
|
| 92 | + * @since 3.2.0 |
|
| 93 | + * |
|
| 94 | + * @param string $class The css class. |
|
| 95 | + * @param string $message The message. |
|
| 96 | + */ |
|
| 97 | + public function add( $class, $message ) { |
|
| 98 | + |
|
| 99 | + $this->notices[] = sprintf( self::TEMPLATE, $class, $this->transform( $message ) ); |
|
| 100 | + |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Add an update notice (message with a white background and a green left border). |
|
| 105 | + * |
|
| 106 | + * @since 3.2.0 |
|
| 107 | + * |
|
| 108 | + * @param string $message The message to display. |
|
| 109 | + */ |
|
| 110 | + public function add_update( $message ) { |
|
| 111 | + |
|
| 112 | + $this->add( self::UPDATE, $message ); |
|
| 113 | + |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Add an update nag notice (message with a white background and a yellow left border). |
|
| 118 | + * |
|
| 119 | + * @since 3.2.0 |
|
| 120 | + * |
|
| 121 | + * @param string $message The message to display. |
|
| 122 | + */ |
|
| 123 | + public function add_update_nag( $message ) { |
|
| 124 | + |
|
| 125 | + $this->add( self::UPDATE_NAG, $message ); |
|
| 126 | + |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Add an error notice (message with a white background and a red left border). |
|
| 131 | + * |
|
| 132 | + * @since 3.2.0 |
|
| 133 | + * |
|
| 134 | + * @param string $message The message to display. |
|
| 135 | + */ |
|
| 136 | + public function add_error( $message ) { |
|
| 137 | + |
|
| 138 | + $this->add( self::ERROR, $message ); |
|
| 139 | + |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Add a suggestion notice (message with a white background and a WordLift brand colored left border). |
|
| 144 | + * |
|
| 145 | + * @since 3.3.0 |
|
| 146 | + * |
|
| 147 | + * @param string $message The message to display. |
|
| 148 | + */ |
|
| 149 | + public function add_suggestion( $message ) { |
|
| 150 | + |
|
| 151 | + $this->add( self::SUGGESTION, $message ); |
|
| 152 | + |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Print out the notices when the admin_notices action is called. |
|
| 157 | + * |
|
| 158 | + * @since 3.2.0 |
|
| 159 | + */ |
|
| 160 | + public function admin_notices() { |
|
| 161 | + |
|
| 162 | + foreach ( $this->notices as $notice ) { |
|
| 163 | + echo( $notice ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Transform message depending on message type. Return a string |
|
| 170 | + * |
|
| 171 | + * @since 3.3.0 |
|
| 172 | + * |
|
| 173 | + * @param string $message The message. |
|
| 174 | + */ |
|
| 175 | + private function transform( $message ) { |
|
| 176 | + |
|
| 177 | + switch ( gettype( $message ) ) { |
|
| 178 | + case 'array': |
|
| 179 | + return implode( $message, '<br />' ); |
|
| 180 | + default: |
|
| 181 | + return $message; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function __construct() { |
| 70 | 70 | |
| 71 | 71 | // Hook to be called when to display notices. |
| 72 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 72 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
| 73 | 73 | |
| 74 | 74 | self::$instance = $this; |
| 75 | 75 | |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @param string $class The css class. |
| 95 | 95 | * @param string $message The message. |
| 96 | 96 | */ |
| 97 | - public function add( $class, $message ) { |
|
| 97 | + public function add($class, $message) { |
|
| 98 | 98 | |
| 99 | - $this->notices[] = sprintf( self::TEMPLATE, $class, $this->transform( $message ) ); |
|
| 99 | + $this->notices[] = sprintf(self::TEMPLATE, $class, $this->transform($message)); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @param string $message The message to display. |
| 109 | 109 | */ |
| 110 | - public function add_update( $message ) { |
|
| 110 | + public function add_update($message) { |
|
| 111 | 111 | |
| 112 | - $this->add( self::UPDATE, $message ); |
|
| 112 | + $this->add(self::UPDATE, $message); |
|
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @param string $message The message to display. |
| 122 | 122 | */ |
| 123 | - public function add_update_nag( $message ) { |
|
| 123 | + public function add_update_nag($message) { |
|
| 124 | 124 | |
| 125 | - $this->add( self::UPDATE_NAG, $message ); |
|
| 125 | + $this->add(self::UPDATE_NAG, $message); |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @param string $message The message to display. |
| 135 | 135 | */ |
| 136 | - public function add_error( $message ) { |
|
| 136 | + public function add_error($message) { |
|
| 137 | 137 | |
| 138 | - $this->add( self::ERROR, $message ); |
|
| 138 | + $this->add(self::ERROR, $message); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @param string $message The message to display. |
| 148 | 148 | */ |
| 149 | - public function add_suggestion( $message ) { |
|
| 149 | + public function add_suggestion($message) { |
|
| 150 | 150 | |
| 151 | - $this->add( self::SUGGESTION, $message ); |
|
| 151 | + $this->add(self::SUGGESTION, $message); |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function admin_notices() { |
| 161 | 161 | |
| 162 | - foreach ( $this->notices as $notice ) { |
|
| 163 | - echo( $notice ); |
|
| 162 | + foreach ($this->notices as $notice) { |
|
| 163 | + echo($notice); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | } |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @param string $message The message. |
| 174 | 174 | */ |
| 175 | - private function transform( $message ) { |
|
| 175 | + private function transform($message) { |
|
| 176 | 176 | |
| 177 | - switch ( gettype( $message ) ) { |
|
| 177 | + switch (gettype($message)) { |
|
| 178 | 178 | case 'array': |
| 179 | - return implode( $message, '<br />' ); |
|
| 179 | + return implode($message, '<br />'); |
|
| 180 | 180 | default: |
| 181 | 181 | return $message; |
| 182 | 182 | } |