PluginProbe
Maps Plugin using Google Maps for WordPress – WP Google Map / trunk
Maps Plugin using Google Maps for WordPress – WP Google Map vtrunk
1.9.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 All 96 releases
gmap-embed / includes / traits / CommonFunctions.php

CommonFunctions.php in Maps Plugin using Google Maps for WordPress – WP Google Map trunk, at includes/traits/CommonFunctions.php

33 lines 753 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WGMSRM\Traits;
3
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7 /**
8 * Trait CommonFunctions
9 */
10 trait CommonFunctions
11 {
12
13 /**
14 * Update post meta
15 *
16 * @param int $post_id
17 * @param string $field_name
18 * @param string $value
19 */
20 public function wgm_update_post_meta($post_id, $field_name, $value = '')
21 {
22 // Sanitize and validate input before updating post meta
23 $post_id = intval($post_id);
24 $field_name = sanitize_key($field_name);
25 // $value should be sanitized/validated before calling this function, or sanitize here if generic
26 if (!get_post_meta($post_id, $field_name)) {
27 add_post_meta($post_id, $field_name, $value);
28 } else {
29 update_post_meta($post_id, $field_name, $value);
30 }
31 }
32 }
33